JBoss AS 7在同一个耳朵中引用了其他模块中的类

时间:2012-07-25 12:55:23

标签: jboss

你好我尝试从jboss 4.2.3迁移到jboss 7,我有一些问题。我的问题是如何在战争(dts.war)中需要时在其他jar中指定一个类(dts.jar中的ChartGenerateVariables.class)。如何编辑战争,他知道其他模块中需要的类(这次在jar文件中)和其他问题是如何解决此错误无法加载实体类'com.recglobal.dts.model.views.PlanSalesValue'与PersistenceUnitInfo.getNewTempClassLoader( )。关于这个问题我没有任何线索,这次它不是一个jar文件或东西,而是它自己的类,只是它是一个@Entity。 MAybe现在有些人会对此有所了解。

12:19:26,839 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.subunit."dts.ear"."dts.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."dts.ear"."dts.war".INSTALL: Failed to process phase INSTALL of subdeployment "dts.war" of deployment "dts.ear"

    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_15]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_15]
    at java.lang.Thread.run(Thread.java:619) [:1.6.0_15]

***Caused by: java.lang.RuntimeException: Error getting reflective information for class com.recglobal.dts.chart.SalesGoalChartServlet***
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
    at org.jboss.as.ee.component.EEModuleClassDescription$DefaultConfigurator.configure(EEModuleClassDescription.java:176)
    at org.jboss.as.ee.component.deployers.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:147)
    at org.jboss.as.ee.component.deployers.EEClassConfigurationProcessor$1.compute(EEClassConfigurationProcessor.java:122)
    at org.jboss.as.ee.component.LazyValue.get(LazyValue.java:40)
    at org.jboss.as.ee.component.EEApplicationDescription.getClassConfiguration(EEApplicationDescription.java:183)
    at org.jboss.as.ee.component.ComponentDescription.createConfiguration(ComponentDescription.java:153)
    at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:70)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]

    ... 5 more

**Caused by: java.lang.NoClassDefFoundError: com/recglobal/dts/chart/ChartGenerateVariables**
    at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_15]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_15]
    at java.lang.Class.getDeclaredMethods(Class.java:1791) [:1.6.0_15]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]

    ... 13 more

**Caused by: java.lang.ClassNotFoundException: com.recglobal.dts.chart.ChartGenerateVariables from [Module "deployment.dts.ear.dts.war:main" from Service Module Loader]**
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) [jboss-modules.jar:1.0.2.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361) [jboss-modules.jar:1.0.2.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333) [jboss-modules.jar:1.0.2.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333) [jboss-modules.jar:1.0.2.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310) [jboss-modules.jar:1.0.2.GA]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103) [jboss-modules.jar:1.0.2.GA]
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) [:1.6.0_15]
    ... 18 more


12:19:31,436 INFO  [org.jboss.jpa] (MSC service thread 1-3) starting Persistence Unit Service 'dts.ear/dts.jar#dts'

12:19:34,804 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-3) HCANN000001: Hibernate Commons Annotations {4.0.0.CR2}

12:19:34,868 INFO  [org.hibernate.Version] (MSC service thread 1-3) HHH00412:Hibernate Core {4.0.0.CR2}

12:19:34,991 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH00206:hibernate.properties not found

12:19:34,992 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH00021:Bytecode provider name : javassist

12:19:35,185 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-3) HHH00204:Processing PersistenceUnitInfo [

    name: dts

    ...]

12:19:35,250 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."dts.ear/dts.jar#dts": org.jboss.msc.service.StartException in service jboss.persistenceunit."dts.ear/dts.jar#dts": Failed to start service

    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_15]

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_15]

    at java.lang.Thread.run(Thread.java:619) [:1.6.0_15]

**Caused by: java.lang.RuntimeException: error trying to scan <jar-file>: vfs:/D:/liferay-portal-6.1.0-ce-ga1/jboss-7.0.2/bin/content/dts.ear/dts.jar/**

    at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:849)

    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:591)

    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72)

    at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:143)

    at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:77)

    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

    ... 3 more

**Caused by: java.lang.RuntimeException: could not load entity class 'com.recglobal.dts.model.views.PlanSalesValue' with PersistenceUnitInfo.getNewTempClassLoader()**

    at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getClassesInJar(HibernateAnnotationScanner.java:152)

    at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:479)

    at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:846)

    ... 9 more

**Caused by: java.lang.ClassNotFoundException: com.recglobal.dts.model.views.PlanSalesValue from [Module "deployment.dts.ear.dts.jar:main" from Service Module Loader]**

    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)

    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)

    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)

    at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getClassesInJar(HibernateAnnotationScanner.java:148)

    ... 11 more

2 个答案:

答案 0 :(得分:1)

你有一个简单的错误: 引起:java.lang.ClassNotFoundException:com.recglobal.dts.chart.ChartGenerateVariables来自[Module“deployment.dts.ear.dts.war:main”from Service Module Loader]

这意味着你在类路径中没有这个类。

在耳包中你有战争,ejb和alco client jar。但是在JEE6中有一个很好的做法,将所有jar保存到lib目录中。因此,lib dir中的所有jar都可以在其他包战争中看到全局,ejb ..

例如,我们从war包中删除了arr jar依赖项,因为我们有多个war`s,所以我们的项目可能非常繁重。我们将所有jar依赖项复制到lib ear文件夹中。

在maven你只需添加简单:

 <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>

并在你的耳朵pom设置skinnywar

答案 1 :(得分:0)

JBoss 7有一个新的模块系统,因此模块在默认情况下不再可见,这很好,因为现在您可以显式控制依赖项。 您所需要做的就是将依赖项添加到您的清单文件中。

https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Add_an_Explicit_Module_Dependency_to_a_Deployment1.html