我尝试从 jboss 4.2.3 迁移到 jboss 7.0.2。当我尝试在下面部署我的 ear 文件时:
META-INF/
META-INF/MANIFEST.MF
commons-beanutils-1.8.0.jar
commons-collections-3.2.jar
commons-digester-1.8.1.jar
commons-logging-1.0.4.jar
dts.jar
dts.sar
dts.war
itext-2.1.2.jar
itext-rtf-2.1.2.jar
jboss-el-1.0_02.CR3.jar
jboss-seam-2.2.0.GA.jar
jboss-seam-excel-2.2.0.GA.jar
jboss-seam-jul-2.2.0.GA.jar
jboss-seam-mail-2.2.0.GA.jar
jboss-seam-pdf-2.2.0.GA.jar
jboss-seam-ui-2.2.0.GA.jar
jcommon-1.0.16.jar
jfreechart-1.0.13.jar
jsf-facelets-1.1.15.B1.jar
jta-1.1.jar
jxl-2.6.8-seam.jar
loginHook-hook.war
META-INF/application.xml
META-INF/jboss-deployment-structure.xml
portal-client-6.1.0.jar
quartz-1.8.4.jar
richfaces-api-3.3.3.Final.jar
richfaces-impl-3.3.3.Final.jar
richfaces-ui-3.3.3.Final.jar
slf4j-api-1.6.0.jar
util-bridges-6.1.0.jar
util-java-6.1.0.jar
util-taglib-6.1.0.jar
xpp3_min-1.1.3.4.O.jar
xstream-1.1.3.jar
META-INF/maven/
META-INF/maven/com.recglobal.dts/
META-INF/maven/com.recglobal.dts/dts-ear/
META-INF/maven/com.recglobal.dts/dts-ear/pom.xml
META-INF/maven/com.recglobal.dts/dts-ear/pom.properties
我收到此错误:
13:17:57,562 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) 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
错误的原因是,在部署 dts.war 时,dts.war 需要一个来自 dts.jar 的方法(如下):
META-INF/
META-INF/MANIFEST.MF
com/
com/recglobal/
com/recglobal/dts/
com/recglobal/dts/chart/AnnualChart.class
com/recglobal/dts/chart/ChartGenerateVariables.class
com/recglobal/dts/chart/ChartGenerator$1.class
com/recglobal/dts/chart/ChartGenerator.class
com/recglobal/dts/chart/ChartType.class
com/recglobal/dts/chart/QuarterlyChart.class
com/recglobal/dts/chart/RangeUtil.class
com/recglobal/dts/chart/Timescale.class
com/recglobal/dts/chart/XYBarAlarmRenderer.class
components.properties
dts-app-features.xml
features.xsd
META-INF/persistence.xml
seam.properties
META-INF/maven/
META-INF/maven/com.recglobal.dts/
META-INF/maven/com.recglobal.dts/dts-logic/
META-INF/maven/com.recglobal.dts/dts-logic/pom.xml
META-INF/maven/com.recglobal.dts/dts-logic/pom.properties
因此,为了解决这个问题,我将 dts.ear 中的 Jboss-deployment-structure.xml 编辑为:
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclusions>
</exclusions>
<dependencies>
<module name="deployment.dts.ear.dts.jar" />
<module name="deployment.dts.ear.dts.war" />
</dependencies>
<resources>
</resources>
</deployment>
<sub-deployment name="dts.war">
<dependencies>
<module name="deployment.dts.ear.d2ts.jar" />
</dependencies>
<resources>
<resource-root path="deployment.dts.ear.dts.jar.com.recglobal.dts.chart.ChartGenerateVariables"/>
</resources>
</sub-deployment>
</jboss-deployment-structure>
我在论坛和谷歌上尝试了很多组合,但一切都以同样的错误结束。也尝试编辑 MANIFEST.MF 但没有任何效果。一般我不知道当 ClassLoader 找不到类或 JAR 文件时该怎么办。类加载器甚至无法在 WEB-INF/lib 的 dts.war 中找到 jars(生病了!)我必须将它们移动到 EAR 并在 dts.war.pom.xml 中标记为提供但现在我已经尝试部署 dts.jar来自 EAR,即使是假的 dts.war 仍然看不到我的逻辑 jar(dts.jar)。我真的需要帮助,因为我的想法已经不多了。你不能问我你需要什么。所以请帮助我:)