Jboss quickstart示例 - BeanManager的ClassNotFoundException

时间:2018-02-24 20:45:48

标签: java-ee jboss jboss-eap-7

我正在尝试运行JBoss EAP 7的hibernate5 quickstart示例。我启动服务器并运行mvn clean install wilfly:deploy,因为README文件说明了,我在服务器中看到了这个异常:

21:33:23,327 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 67) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
21:33:23,328 WARN  [org.hibernate.dialect.H2Dialect] (ServerService Thread Pool -- 67) HHH000431: Unable to determine H2 database version, certain features may not work
21:33:23,348 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 67) MSC000001: Failed to start service jboss.persistenceunit."jboss-hibernate5.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."jboss-hibernate5.war#primary": javax.persistence.PersistenceException: [PersistenceUnit: primary] Unable to build Hibernate SessionFactory
    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:667)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: primary] Unable to build Hibernate SessionFactory
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882)
    at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
    ... 7 more
Caused by: org.hibernate.HibernateException: Could not access BeanManager ListenerFactory class [org.hibernate.jpa.event.internal.jpa.ListenerFactoryBeanManagerStandardImpl] to handle CDI extensions
    at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildBeanManagerListenerFactory(ListenerFactoryBuilder.java:88)
    at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildStandardBeanManagerListenerFactory(ListenerFactoryBuilder.java:51)
    at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildListenerFactory(ListenerFactoryBuilder.java:39)
    at org.hibernate.jpa.event.spi.JpaIntegrator.integrate(JpaIntegrator.java:129)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879)
    ... 11 more
Caused by: java.lang.NoClassDefFoundError: javax/enterprise/inject/spi/BeanManager
    at org.hibernate.jpa.event.internal.jpa.ListenerFactoryBeanManagerStandardImpl.fromBeanManagerReference(ListenerFactoryBeanManagerStandardImpl.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.hibernate.jpa.event.spi.jpa.ListenerFactoryBuilder.buildBeanManagerListenerFactory(ListenerFactoryBuilder.java:72)
    ... 17 more
Caused by: java.lang.ClassNotFoundException: javax.enterprise.inject.spi.BeanManager from [Module "org.hibernate:main" from local module loader @5b1d2887 (finder: local module finder @46f5f779 (roots: /home/user/Downloads/Software/jboss-eap-7.0/modules,/home/user/Downloads/Software/jboss-eap-7.0/modules/system/layers/base))]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
    ... 23 more

以下是运行 mvn依赖关系的依赖树:tree -Dverbose = true (是正确的命令吗?):

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ jboss-hibernate5 ---
[INFO] org.jboss.quickstarts.eap:jboss-hibernate5:war:7.0.0.GA
[INFO] +- javax.enterprise:cdi-api:jar:1.2.0.redhat-2:provided
[INFO] |  \- javax.inject:javax.inject:jar:1.0.0.redhat-6:provided (version managed from 1)
[INFO] +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final-redhat-1:provided
[INFO] +- org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar:1.0.0.Final-redhat-1:provided
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final-redhat-1:provided
[INFO] +- org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:jar:1.0.0.Final-redhat-1:provided
[INFO] +- org.hibernate:hibernate-validator:jar:5.2.4.Final-redhat-1:provided
[INFO] |  +- javax.validation:validation-api:jar:1.1.0.Final-redhat-1:provided (version managed from 1.1.0.Final)
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final-redhat-1:provided (version managed from 3.2.1.Final)
[INFO] |  \- com.fasterxml:classmate:jar:1.1.0:provided
[INFO] +- org.jboss.spec.javax.faces:jboss-jsf-api_2.2_spec:jar:2.2.12.redhat-1:provided
[INFO] \- org.hibernate:hibernate-core:jar:5.0.9.Final-redhat-1:provided
[INFO]    +- (org.jboss.logging:jboss-logging:jar:3.3.0.Final-redhat-1:provided - version managed from 3.3.0.Final; omitted for duplicate)
[INFO]    +- (org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final-redhat-1:provided - version managed from 1.0.0.Final; omitted for duplicate)
[INFO]    +- org.javassist:javassist:jar:3.18.1-GA:provided
[INFO]    +- antlr:antlr:jar:2.7.7:provided
[INFO]    +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:provided
[INFO]    +- org.jboss:jandex:jar:2.0.0.Final:provided
[INFO]    +- dom4j:dom4j:jar:1.6.1:provided
[INFO]    \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:provided
[INFO]       \- (org.jboss.logging:jboss-logging:jar:3.3.0.Final-redhat-1:provided - version managed from 3.3.0.Final; omitted for duplicate)

有什么问题?

0 个答案:

没有答案