当我在wildfly9.0中部署war文件时,我得到以下错误;任何线索?
Hibernate version = 5.0.1.Final
Hibernate验证器版本= 5.2.1.Final
09:57:34,368 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 64) 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.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
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.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
at org.hibernate.cfg.AttributeConverterDefinition.<init>(AttributeConverterDefinition.java:67)
at org.hibernate.cfg.Configuration.addAttributeConverter(Configuration.java:2729)
at org.hibernate.cfg.Configuration.addAttributeConverter(Configuration.java:2673)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildHibernateConfiguration(EntityManagerFactoryBuilderImpl.java:1153)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:853)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
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
09:57:34,381 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-9) WFLYCTL0013: Operation ("add") 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.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
C
答案 0 :(得分:0)
Wildfly 9&包含的hibernate版本不是5.请参阅What versions of libraries are shipped with WildFly 9.0.1.Final 可能你必须使用正确的版本或排除服务器&#39;使用jboss-deployment-structure.xml的库。或者试试Wildfly 10,其中包括hibernate 5.