我正在使用以下hibernate jar [1];当我在wildfly 9中部署war文件时,出现以下错误。
我如何克服这个问题?
5:34:53,204 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 88) MSC000001: Failed to start service jboss.persistenceunit."test2dbwar.war#test2dbwar-persistence-unit": org.jboss.msc.service.StartException in service jboss.persistenceunit."test2dbwar.war#test2dbwar-persistence-unit": java.util.ServiceConfigurationError: org.hibernate.service.spi.ServiceContributor: Provider org.hibernate.spatial.integration.SpatialInitializer not a subtype
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:665)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
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)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.util.ServiceConfigurationError: org.hibernate.service.spi.ServiceContributor: Provider org.hibernate.spatial.integration.SpatialInitializer not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:341)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.applyServiceContributors(StandardServiceRegistryBuilder.java:270)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.build(StandardServiceRegistryBuilder.java:249)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildServiceRegistry(EntityManagerFactoryBuilderImpl.java:1035)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)
... 7 more
15:34:53,211 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 12) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "test2dbwar.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"test2dbwar.war#test2dbwar-persistence-unit\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test2dbwar.war#test2dbwar-persistence-unit\": java.util.ServiceConfigurationError: org.hibernate.service.spi.ServiceContributor: Provider org.hibernate.spatial.integration.SpatialInitializer not a subtype
Ca
[1]
修改 JBoss的部署 - structure.xml;
<jboss-deployment-structure >
<deployment>
<!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
<!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
<exclude-subsystems>
<subsystem name="org.hibernate" />
</exclude-subsystems>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.hibernate" />
</exclusions>
</deployment>
</jboss-deployment-structure>
答案 0 :(得分:1)
与您的previous question一样,当您使用不兼容的版本时,您可能会遇到各种令人惊讶的错误。正如您在堆栈跟踪中看到的那样,您实际上正在使用Hibernate 4,因为Wildfly 9包含Hibernate 4。