SpringCloud
1 | Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration. |
spring-boot-starter-web与spring-cloud-starter-gateway存在jar包冲突
Spring Cloud Gateway 是使用 netty+webflux 实现因此不需要再引入 web 模块。
1 | java.lang.IllegalStateException: PathVariable annotation was empty on param 0. |
使用Spring Cloud Feign 的时候,如果参数中带有@PathVariable形式的参数,则要用value=””标明对应的参数,否则会抛出IllegalStateException异常
如:@PathVariable(value = “groupType”) String groupType
1 | java.lang.IllegalArgumentException: Body parameter 0 was null |
Spring Cloud Feign 远程调用需要携带参数,但实际上没没有携带
1 | java.lang.IllegalStateException: Only one connection receive subscriber allowed. |
Spring Cloud Gateway 中,requestBody只允许读取一次,解决方法就是读取后需要在写入一个request。
ES相关
1 | None of the configured nodes are available: [] |
节点网络连接问题
数据库相关
mysql排序稳定性问题
1 | Cause: java.sql.SQLException: Zero date value prohibited |
数据时区错误,由于数据库字段timestamp类型有时间0000-00-00 00:00:00,修改为正常时间即可。
timestamp的默认值:CURRENT_TIMESTAMP(插入时个更新时间)、ON UPDATE CURRENT_TIMESTAMP(仅在更新时设置时间,插入时赋值)、CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP (创建和修改时都修改此值)
1 | Cause: java.sql.SQLException: Incorrect DECIMAL value: '0' for column '' at row -1 |
根本解法:对数据输入严格校验,避免出现cast转换值为null的情况,或者对于null的情况从逻辑上进行控制
1 | Cause: org.mybatis.spring.MyBatisSystemException: There is no getter for property named 'projectId' in 'class java.lang.String' |
1 | <select id="list" parameterType="java.lang.String" resultType="java.lang.String"> |
压测相关
1 | Cause: java.net.NoRouteToHostException: Cannot assign requested address. |
系统的连接端口耗尽
前端相关
Http ResponseHeader 中的自定义属性,如果浏览器请求抓包可以看到,但是js中获取不到,则需要检查跨域配置
解决: 响应头Access-Control-Expose-Headers,配置自定义属性,然后就可以获取到了。
问题请求:angular1.6 $http.post
原文:http://www.it1352.com/886056.html
参考:跨域资源共享 CORS 详解
在react中,setState是异步操作,赋值后不能马上生效。
1 | The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. |
当看到此错误时注意,当前端请求配置credentials: “include”时,后端需要配置”Access-Control-Allow-Credentials”为true,这样才能使带credentials的CORS请求成功。
SpringBoot2.0下对跨域的处理方式可以为使用@CrossOrigin注解或者编写配置类实现WebMvcConfigurer接口的addCorsMappings方法。
1 | @Override |
React Eslint 报错与警告
Do not use setState in componentDidMount
componentDidMount 执行是在DOM渲染完成后,在这里面使用setState会触发重绘,相当于进行了两次渲染,因此建议在constructor或者componentWillMount中把准备工作做好。当然在componentDidMount 周期异步获取数据并通过setState赋值是正确逻辑。
Arrow function should not return assignment.1
<div ref={(el) => { this.myCustomEl = el }} />
在使用箭头函数的时候,不应当返回赋值语句。
JSX props should not use arrow functions
A bind call or arrow function in a JSX prop will create a brand new function on every single render. This is bad for performance, as it may cause unnecessary re-renders if a brand new function is passed as a prop to a component that uses reference equality check on the prop to determine if it should update.
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
Expected to return a value in arrow function array-callback-return
Linux及生产环境问题
磁盘没有空间:Error: ENOSPC: no space left on device, write
解决方案:增大磁盘空间或删除迁移没用文件,如日志文件