Myeclipse2015+Maven3时同一个项目在不同主机的环境表现不同,有时不会报错,有时出现奇怪的错误,错误信息如下:
1. Exception starting filter OpenSessionInViewFilter java.lang.NoSuchFieldError: MANUAL
2. java.lang.NoSuchFieldError: MANUAL
3. 无法找到某个用户定义的类;
后来发现pom.xml文件中有重复的jar包声明:
<!-- hibernate部分 -->
<!--重复部分 <dependency><groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.0.5</version>
</dependency>
-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.2.0.Final</version>
</dependency>
将重复部分注释掉及运行正常。