我有解决某些依赖冲突的问题。
我开发了一个应用程序,使用Hibernate 4.2.18.Final在我的本地JBoss Dev Studio上使用JBoss EAP 6.1+作为服务器。 但是,当我在我们的服务器上部署它时,同样的应用程序失败了 - JBoss EAP 6.4.0.GA。
我收到了这些错误:
java.lang.NoClassDefFoundError:无法初始化类 com.lionco.hibernate.HibernateUtil
和
org.hibernate.annotations.common.reflection.java.JavaReflectionManager 无法施展 org.hibernate.annotations.common.reflection.MetadataProviderInjector
似乎与依赖冲突有关,可能是hibernate.logging,但我找不到任何有关它的信息。
我目前的Pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lionco</groupId>
<artifactId>Bus</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Bus</name>
<description>Bus</description>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-all</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.14</version>
<exclusions>
<exclusion>
<artifactId>jersey-bean-validation</artifactId>
<groupId>org.glassfish.jersey.ext</groupId>
</exclusion>
<exclusion>
<artifactId>bean-validator</artifactId>
<groupId>org.glassfish.hk2.external</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.github.dvdme</groupId>
<artifactId>ForecastIOLib</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.reficio</groupId>
<artifactId>soap-builder</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.reficio</groupId>
<artifactId>soap-client</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.reficio</groupId>
<artifactId>soap-server</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
</dependency>
<dependency>
<groupId>com.google.maps</groupId>
<artifactId>google-maps-services</artifactId>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.18.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.2.18.Final</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>reficio</id>
<url>http://repo.reficio.org/maven/</url>
</repository>
</repositories>
</project>
任何想法都会非常感激:)谢谢
答案 0 :(得分:0)
Hibernate与JBoss捆绑在一起,因此hibernate-core
依赖应该是范围提供。
不太确定hibernate-c3p0
..我会尝试离开编译范围,看看会发生什么
答案 1 :(得分:0)
我终于解决了我的问题。这是不同版本的hibernate-logging(或hibernate-commons-logging)之间的冲突。
在eclipse上它使用了正确的文件,但我的jar包含了一些相互矛盾的最旧版本。
我通过删除项目文件夹中的前一个jar修复了问题。