0

我有以下情况:

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

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

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

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
4

2 回答 2

0

异常清楚地表明它找不到类 gss.commons.exceptions.BusinessEntityFindException

您的 ejb jar 文件MANIFEST.MF应该包含它需要的类路径,例如

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在您的服务器类路径中。

于 2012-11-26T13:22:08.117 回答
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 的文件并添加:

<

<?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
  • 添加:

<

<?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 服务器
于 2012-11-28T00:17:25.267 回答