在jboss-as-7.1.1上部署jar文件时出错

时间:2012-11-26 13:04:53

标签: java jboss jboss7.x

我有以下情况:

我有一个包含三个项目的java应用程序:

  • Java Project
  • EJB模块
  • 网络项目

使用net bean,我构建了三个项目并将它们上传到服务器上。 Java Project已成功部署,但依赖于Java Project的EJB Module出现以下错误:

12:35:00,811 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."MyApp.jar".POST_MODULE: org.jboss.msc.service$
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [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.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_20]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_20]
        at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_20]


Caused by: java.lang.RuntimeException: Error getting reflective information for class gss.myapp.sessions.CardValidatorBean with ClassLoader ModuleClassLoader for Module "deplo$
        at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
        at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
        at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
        at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        ... 5 more

Caused by: java.lang.NoClassDefFoundError: gss/commons/exceptions/BusinessEntityFindException
        at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_20]
        at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.6.0_20]
        at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.6.0_20]
        at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        ... 10 more

Caused by: java.lang.ClassNotFoundException: gss.commons.exceptions.BusinessEntityFindException from [Module "deployment.MyApp.jar: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.performLoadClassChecked(ConcurrentClassLoader.java:423)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        ... 15 more

2 个答案:

答案 0 :(得分:0)

该例外明确指出它无法找到该类 gss.commons.exceptions.BusinessEntityFindException

您的ejb jar文件MANIFEST.MF应包含所需的类路径 e.g

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_25-b06 (Sun Microsystems Inc.)
Class-Path: your-java-project.jar

并确保在服务器类路径中包含your-java-project.jar

答案 1 :(得分:0)

您需要将gss.commons.exceptions.BusinessEntityFindException类添加到JBoss:

我将 YOUR_JAR.jar 调用包含gss / commons / exceptions / BusinessEntityFindException

的jar

1:向JBoss添加模块

  • 停止JBoss服务器
  • 在您的目录中找到YOUR_JAR.jar
  • 在JBoss上创建下一个目录:JBOSS_HOME / modules / org / gss / main
  • 将YOUR_JAR.jar放在此目录
  • 创建一个名为module.xml的文件并添加:

&LT;

<?xml version="1.0" encoding="UTF-8"?>
 <module xmlns="urn:jboss:module:1.1" name="org.gss">
 <resources>
 <resource-root path="YOUR_JAR.jar"/>
 </resources>
</module>

*

2:从项目中调用新模块:

  • 在您的Web项目上创建一个文件WEB-INF / jboss-deployment-structure.xml
  • 添加:

&LT;

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
      <dependencies>
         <module name="org.gss" meta-inf="export">
            <imports>
               <include path="META-INF" />
            </imports>
         </module>
      </dependencies>
   </deployment>
</jboss-deployment-structure>
  • 启动您的Jboss服务器