启动tomcat运行项目时出现以下异常
Caused by: java.lang.Error: Unresolved compilation problems:
The import javax.xml.bind cannot be resolved
The import javax.xml.bind cannot be resolved
The import javax.xml.bind cannot be resolved
The import org.codehaus cannot be resolved
XmlRootElement cannot be resolved to a type
XmlAccessorType cannot be resolved to a type
The attribute value is undefined for the annotation type XmlAccessorType
XmlAccessType cannot be resolved to a variable
JsonSerialize cannot be resolved to a type
The attribute using is undefined for the annotation type JsonSerialize
执行mvn clean install成功,但反编译发现代码不是我的代码,如下
public String getId() {
throw new Error("Unresolved compilation problem: \n");
}
public void setId(String paramString) {
throw new Error("Unresolved compilation problem: \n");
}
public Date getUpdateTime() {
throw new Error("Unresolved compilation problems: \n\tJsonSerialize cannot be resolved to a type\n\tThe attribute using is undefined for the annotation type JsonSerialize\n");
}
public void setUpdateTime(Date paramDate) {
throw new Error("Unresolved compilation problem: \n");
}
请高手解答,或给出可能原因,谢谢。
1.首先确保eclipse工程Java Compiler属性中的JDK Compliance与Java Build Path中的JRE System library中的JDK版本保持一致。
2.本地JDK尽量使用较新版本,从而使本地编译器比所依赖的jar包编译器要新,使其向老版本兼容,反之则不行。比如,你本地用jdk1.5编译,而所依赖的jar包是用jdk1.6编译的,可能就会有问题。
3.确保本地代码编译时所依赖的JAR包是正确的版本,并且同一jar包不要有多个版本重复引入。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。