注:很多报错是因为jar包冲突或引入了无用的包,先检查。
--
1,Caused by: java.lang.NoClassDefFoundError: com/google/common/cache/CacheLoader
检查是否用到缓存,如不,检查lib的jar包有无引入了cache包,有则删掉。如用到,则响应的包:guava-17.0.jar
2,java.lang.NoClassDefFoundError: org/springframework/context/EnvironmentAware
加入spring-context-4.x.x.RELEASE.jar
3,POST 400 Bad Request The request sent by the client was syntactically incorrect
4,找不到国际化资源文件报错:Can't find bundle for base name messages.properties, locale zh_CN
处理:一般是配错了名称,比如资源文件messages.properties在classpath下resources目录下,则获取代码为
ResourceBundle rb = ResourceBundle.getBundle("resources.messages", locale);//messages表示文件名,其中.点也可改为斜杠resources/messages String retValue = rb.getString("102");//101是messages.properties文件中的key System.out.println(retValue);