错误踩坑记录

电玩女神 2023-01-01 02:54 421阅读 0赞

文章目录

    • linux相关
      • mvnw: Permission denied
      • curl请求ipv6接口
    • ide相关
      • 修改idea编译器堆内存
    • thrift相关
    • Springboot相关
      • 单测
      • websocket
    • Nginx相关
      • nginx自动过滤下滑线的header

linux相关

mvnw: Permission denied

解决

  1. chmod +x mvnw

curl请求ipv6接口

在Linux中我们常常使用curl去请求接口

  1. curl -X GET http://ipv4:port/addr/

这是没问题的,但是我们针对ipv6同样这样请求

  1. curl -X GET http://ipv6:port/addr/

会报错:

  1. curl: (3) IPv6 numerical address used in URL without brackets

解决

  1. curl -X GET http://[ipv6]:port/addr/

ide相关

修改idea编译器堆内存

编译报错:OOM

  1. javac OutOfMemoryError when compiling IDEA 7

解决
On the Mac this is another way to get there: Application menu > Preferences > Compiler

thrift相关

thrift编译错误
在这里插入图片描述
版本0.9.3
之前这个thrift文件在0.9.2下编译是没问题
解决
在这里插入图片描述

Springboot相关

单测

在使用mockMvc时遇到这个问题:

  1. SpringBootTest : No qualifying bean of type 'org.springframework.test.web.servlet.MockMvc' available:

解决

  1. @RunWith(SpringRunner.class)
  2. @SpringBootTest
  3. public class ApplicationTest {
  4. @Autowired
  5. private WebApplicationContext webApplicationContext;
  6. private MockMvc mockMvc;
  7. @Before
  8. public void setUp() {
  9. mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
  10. }

websocket

在websocket中无法注入service
在这里插入图片描述

解决

上述方式尝试后发现只能注入一个bean还是有注入失败的情况

解决

Nginx相关

nginx自动过滤下滑线的header

nginx代理服务器,app发出的请求头被直接过滤了,当时想到nginx会自动过滤掉带有_的请求头信息,所以直接改了Nginx的配置当然也可以将app的request中header中的_改为-

修改nginx配置,在http中增加

  1. vi /usr/local/nginx/conf/nginx.conf
  2. underscores_in_headers on;

vhost中的配置也贴下吧

  1. location / {
  2. proxy_set_header Host $host:80;
  3. proxy_set_header X-Real-IP $remote_addr;
  4. proxy_set_header x-forwarded-for $remote_addr;
  5. proxy_pass http://xxxxxxx:51001;
  6. }

发表评论

表情:
评论列表 (有 0 条评论,421人围观)

还没有评论,来说两句吧...

相关阅读

    相关 springboot记录

    使用sts,或者是官方的地址新建springboot项目,导入到myeclipse,项目pom文件第一行报错,无任何错误信息,提示unknown,尝试过换maven和jdk版本

    相关 npm记录

    记录使用npm过程中遇到的问题,免得再遇到时还到处搜索 配置npm转到淘宝镜像 安装npm后,默认是使用国外镜像的,所以不翻墙速度简直龟速,使用淘宝镜像就比较快了,切换

    相关 日常记录

    心得 严格的去思考问题,处理问题,有开发责任心,严格要求自己的代码编写习惯与风格 开发踩坑记录,不定时更新 日常踩坑记录 注意 单词拼写!!! 2020

    相关 grafana记录

    1.鼠标移动悬停时数据不变更 鼠标悬停时,数据时间一直不变更,这样鼠标移动时,就没法一眼看出正确数据。比如图中,鼠标悬停在8-29了,但是数据详情还是8-27. ![