我试图将Hibernate从版本 4.2.21.Final 升级到版本 5.2.5.Final ,但自上周以来我遇到了一些麻烦。到目前为止,我还没有能够在我的搜索中找到有关此问题的任何内容...... 每当我修改 pom.xml 并为Hibernate设置新版本时,我在部署项目时会遇到以下异常:
10:08:44,397 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) WFLYDS0004: Found MaisAcoes.war in deployment directory. To trigger deployment create a file called MaisAcoes.war.dodeploy
10:08:44,466 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "MaisAcoes.war" (runtime-name: "MaisAcoes.war")
10:08:47,251 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry activation.jar in /C:/Users/vinic/Desktop/SEATI/wildfly-10.1.0.Final/standalone/deployments/MaisAcoes.war/WEB-INF/lib/mail-1.4.1.jar does not point to a valid jar for a Class-Path reference.
10:08:49,493 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."MaisAcoes.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MaisAcoes.war".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "MaisAcoes.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0019: Could not deploy application packaged persistence provider 'org.hibernate.jpa.HibernatePersistenceProvider'
at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:79)
at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:49)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
Caused by: java.lang.ClassCastException: class org.hibernate.jpa.HibernatePersistenceProvider
at java.lang.Class.asSubclass(Class.java:3404)
at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:72)
... 7 more
10:08:49,505 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "MaisAcoes.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"MaisAcoes.war\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MaisAcoes.war\".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"MaisAcoes.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0019: Could not deploy application packaged persistence provider 'org.hibernate.jpa.HibernatePersistenceProvider'
Caused by: java.lang.ClassCastException: class org.hibernate.jpa.HibernatePersistenceProvider"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"MaisAcoes.war\".FIRST_MODULE_USE"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
10:08:49,658 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "MaisAcoes.war" (runtime-name : "MaisAcoes.war")
10:08:49,658 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."MaisAcoes.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MaisAcoes.war".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "MaisAcoes.war"
我错过了什么?这是我的** 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>MaisAcoes</groupId>
<artifactId>MaisAcoes</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<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>
<!-- ****** HIBERNATE****** -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.5.Final</version>
</dependency>
<!-- ****** ****** -->
<!-- ****** JAVA SERVER FACES ****** -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.13</version>
</dependency>
<!-- ****** ****** -->
<!-- ****** PRIME FACES ****** -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>3.0.0</version>
</dependency>
<!-- ****** ****** -->
<!-- ****** PRIME FACES ALL THEMES****** -->
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.8</version>
</dependency>
<!-- ****** ****** -->
<!-- Apache Commons: Email -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.2</version>
</dependency>
<!-- Java EE 7 -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!-- Quartz (serviço "cron" para o projeto) -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
</project>
我正在使用 WildFly 10.1 。
答案 0 :(得分:-1)
WildFly 10.1.0.Final应该默认为Hibernate 5.0.10.Final。
一般来说,您不能在部署中包含依赖项,并期望Java EE服务器使用依赖项。容器与捆绑的特定版本有很多集成。通常最好不要担心容器中的依赖关系并向Java EE API开发。
用Hibernate说,你可以replace it。