当前位置: 首页 > news >正文

HTTP Error 400 Bad request 问题分析解决

在这里插入图片描述

文章目录

      • 1.问题描述:
      • 2.异常信息如下:
      • 3.分析异常信息:
      • 4.总结:


1.问题描述:

前端保存老是报错HTTP ERROR 400 Bad Request。经过异常分析得出是前端传参导致的后端框架的验证拦截,包的错误。

2.异常信息如下:


{"timestamp":1545873831082,"status":400,"error":"Bad Request","exception":"org.springframework.validation.BindException","errors":[{"codes":["typeMismatch.capitalInvestmentParam.investmentEnsureMoney","typeMismatch.investmentEnsureMoney","typeMismatch.java.math.BigDecimal","typeMismatch"],"arguments":[{"codes":["capitalInvestmentParam.investmentEnsureMoney","investmentEnsureMoney"],"arguments":null,"defaultMessage":"investmentEnsureMoney","code":"investmentEnsureMoney"}],"defaultMessage":"Failed to convert property value of type 'java.lang.String' to required type 'java.math.BigDecimal' for property 'investmentEnsureMoney'; nested exception is java.lang.NumberFormatException","objectName":"capitalInvestmentParam","field":"investmentEnsureMoney","rejectedValue":"null","bindingFailure":true,"code":"typeMismatch"},{"codes":["typeMismatch.capitalInvestmentParam.investmentEnsureMoneyInterest","typeMismatch.investmentEnsureMoneyInterest","typeMismatch.java.math.BigDecimal","typeMismatch"],"arguments":[{"codes":["capitalInvestmentParam.investmentEnsureMoneyInterest","investmentEnsureMoneyInterest"],"arguments":null,"defaultMessage":"investmentEnsureMoneyInterest","code":"investmentEnsureMoneyInterest"}],"defaultMessage":"Failed to convert property value of type 'java.lang.String' to required type 'java.math.BigDecimal' for property 'investmentEnsureMoneyInterest'; nested exception is java.lang.NumberFormatException","objectName":"capitalInvestmentParam","field":"investmentEnsureMoneyInterest","rejectedValue":"null","bindingFailure":true,"code":"typeMismatch"}],"message":"Validation failed for object='capitalInvestmentParam'. Error count: 2","path":"/rayProjectCapitalInvestment/insertStockPowerInvestment"}

3.分析异常信息:

Failed to convert property value of type ‘java.lang.String’ to required type ‘java.math.BigDecimal’ for property ‘investmentEnsureMoneyInterest’; nested exception is java.lang.NumberFormatException

看一下前端传入的参数如下图:
image.png
image.png
前端的参数应该是金额要么是空值,结果传输的时候传一个null,后台接收的时候是用bigDecimal 参数类型导致参数异常,报的400错误问题。

4.总结:

经过分析得出400错误code:数据框架的验证拦截前端传入的参数异常,参数类型异常,一般情况下出现400,都是前端传入的参数异常。

http://www.xdnf.cn/news/787717.html

相关文章:

  • spring boot应答500问题跟踪
  • YAML 文件中不同格式的含义详解
  • Flink 重启后事件被重复消费的原因与解决方案
  • Deep Search之R1-Searcher系列
  • QT实现动画翻转效果
  • Docker 镜像深度剖析:构建、管理与优化
  • 多模态知识图谱可视化构建(neo4j+python+flask+vue环境搭建与示例)
  • 秋招准备-数据结构
  • 前端面试题之Class详解
  • @Resource和@Autowire
  • 《前端面试题:CSS预处理器(Sass、Less等)》
  • 代码训练LeetCode(19)轮转数组
  • 【学习记录】深入解析 AI 交互中的五大核心概念:Prompt、Agent、MCP、Function Calling 与 Tools
  • 全球常用地理信息、遥感数据处理软件介绍(单机版、在线云平台)
  • LeetCode 高频 SQL 50 题(基础版) 之 【高级查询和连接】· 下
  • 【Typst】5.文档结构元素与函数
  • 突破视觉认知边界VisionReasoner:用强化学习统一视觉感知与推理的全能框架
  • 防火墙在OSI模型中的层级工作(2025)
  • 动态规划十大经典题型状态转移、模版等整理(包括leetcode、洛谷题号)
  • Dify-5:Web 前端架构
  • Spring 统一异常处理怎么做?
  • QT 5.9.2+VTK8.0实现等高线绘制
  • Ubuntu中SSH服务器安装使用
  • VMWare安装常见问题
  • MATLAB仿真生成无线通信网络拓扑推理数据集
  • HTTP连接管理——短连接,长连接,HTTP 流水线
  • 【notepad++】如何设置notepad++背景颜色?
  • 在Oxygen编辑器中使用DeepSeek
  • typescript的Interface和Type
  • DPO 算法