错误踩坑记录

linux相关

mvnw: Permission denied

解决

chmod +x mvnw

curl请求ipv6接口

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

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

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

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

会报错:

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

解决

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

ide相关

修改idea编译器堆内存

编译报错:OOM

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时遇到这个问题:

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

解决

@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTest {
    
    

  @Autowired
  private WebApplicationContext webApplicationContext;
  private MockMvc mockMvc;

  @Before
  public void setUp() {
    
    
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
  }

Nginx相关

nginx自动过滤下滑线的header

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

修改nginx配置,在http中增加

vi /usr/local/nginx/conf/nginx.conf

underscores_in_headers on;

vhost中的配置也贴下吧

 location / {
        proxy_set_header  Host $host:80;
        proxy_set_header  X-Real-IP $remote_addr;
        proxy_set_header x-forwarded-for $remote_addr;
        proxy_pass http://xxxxxxx:51001;
  }

猜你喜欢

转载自blog.csdn.net/weixin_41922289/article/details/111997702