我正在尝试使用 Ant 将 EAR 文件部署到我的 JBoss。我正在使用 JBoss 7.1。我已经在那里进行了一些战争(使用相同的部署过程),但是这个 EAR 包含有关我需要工作的框架的数据。这个框架特别使用了一个 JAR (index-app),我已经将它包含在它的 lib 文件夹中。
我的 EAR build.xml 中的这段剪辑显示了它如何从其 lib 文件夹中读取 JAR(所有子文件夹都存在):
<copy todir="${build.home}" flatten="true" includeemptydirs="false">
<fileset dir="${lib.home}">
<include name="index/**/*.jar" />
<include name="crawler/**/*.jar" />
<include name="poi/**/*.jar" />
<include name="*.jar" />
<exclude name="local/**" />
</fileset>
</copy>
当我部署 EAR 时,编译没有问题,只有实际部署在我的日志中生成:
09:33:52,452 INFO [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015876: Starting deployment of "scp-app.ear"
09:33:52,642 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "scp-app-web.war"
09:33:52,642 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "scp-app.jar"
09:33:52,700 INFO [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for CST_SPC_DS
09:33:52,737 WARN [org.jboss.as.ee] (MSC service thread 1-1) JBAS011006: Not installing optional component com.t1c.modules.index.servlets.SPCCentralServlet due to exception: java.lang.ClassNotFoundException: com.t1c.modules.index.servlets.SPCCentralServlet from [Module "deployment.scp-app.ear.scp-app-web.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_39]
at java.lang.Class.forName(Class.java:249) [rt.jar:1.6.0_39]
at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:79)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_39]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_39]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_39]
09:33:52,759 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/spc]] (MSC service thread 1-6) Marking servlet SPC Startup Servlet as unavailable
09:33:52,759 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/spc]] (MSC service thread 1-6) Servlet /spc threw load() exception: java.lang.ClassNotFoundException: com.t1c.modules.index.servlets.SPCCentralServlet from [Module "deployment.scp-app.ear.scp-app-web.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1156) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_39]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_39]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_39]
09:33:52,767 INFO [org.jboss.web] (MSC service thread 1-6) JBAS018210: Registering web context: /spc
09:33:52,968 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "scp-app.ear" was rolled back with failure message JBAS014750: Operation handler failed to complete
09:33:52,983 INFO [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015877: Stopped deployment scp-app-web.war in 13ms
09:33:52,993 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015877: Stopped deployment scp-app.jar in 24ms
09:33:53,004 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015877: Stopped deployment scp-app.ear in 35ms
09:33:53,005 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "JBAS014750: Operation handler failed to complete"}}
我仔细检查了包含类 SPCCentralServlet 的 JAR 文件存在,它就在生成的 EAR 文件内的 JAR 中,但不知何故 JBoss 找不到它。
有没有人有任何解释或想法?