RMIIO和NoClassDefFoundError

时间:2015-02-13 19:53:05

标签: java rmi ejb-3.1 wildfly-8 rmiio

我试图将文件从客户端(JSE)上传到服务器应用程序(Java EE,EJB,Wildfly)。我尝试使用this page中的第一个示例,但是当我尝试在Wildfly服务器上运行服务器应用程序时 - 我收到此错误:

  

19:08:30,077 ERROR [org.jboss.msc.service.fail](MSC服务主题1-1)MSC000001:无法启动服务jboss.deployment.unit。" ProjectEngineerServer.jar" .POST_MODULE:服务jboss.deployment.unit中的org.jboss.msc.service.StartException。" ProjectEngineerServer.jar" .POST_MODULE:JBAS018733:无法处理部署的阶段POST_MODULE" ProjectEngineerServer.jar&# 34;       在org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166)[wildfly-server-8.2.0.Final.jar:8.2.0.Final]       at org.jboss.msc.service.ServiceControllerImpl $ StartTask.startService(ServiceControllerImpl.java:1948)[jboss-msc-1.2.2.Final.jar:1.2.2.Final]       at org.jboss.msc.service.ServiceControllerImpl $ StartTask.run(ServiceControllerImpl.java:1881)[jboss-msc-1.2.2.Final.jar:1.2.2.Final]       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[rt.jar:1.8.0_20]       at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)[rt.jar:1.8.0_20]       在java.lang.Thread.run(Thread.java:745)[rt.jar:1.8.0_20]       引起:java.lang.RuntimeException:JBAS018757:获取类​​com.system.main.HandlingBean的反射信息时出错,使用ClassLoader ModuleClassLoader for Module" deployment.ProjectEngineerServer.jar:main"来自服务模块加载器       at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72)[wildfly-server-8.2.0.Final.jar:8.2.0.Final]       at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)       at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)       at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)       at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)       在org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159)[wildfly-server-8.2.0.Final.jar:8.2.0.Final]       ......还有5个       引起:java.lang.NoClassDefFoundError:com / healthmarketscience / rmiio / RemoteInputStream       at java.lang.Class.getDeclaredMethods0(Native Method)[rt.jar:1.8.0_20]       at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)[rt.jar:1.8.0_20]       at java.lang.Class.getDeclaredMethods(Class.java:1962)[rt.jar:1.8.0_20]       在org.jboss.as.server.deployment.reflect.ClassReflectionIndex。(ClassReflectionIndex.java:65)[wildfly-server-8.2.0.Final.jar:8.2.0.Final]       at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68)[wildfly-server-8.2.0.Final.jar:8.2.0.Final]       ......还有10个       引起:java.lang.ClassNotFoundException:com.healthmarketscience.rmiio.RemoteInputStream来自[Module" deployment.ProjectEngineerServer.jar:main"来自服务模块加载器]       在org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213)[jboss-modules.jar:1.3.3.Final]       在org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459)[jboss-modules.jar:1.3.3.Final]       在org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408)[jboss-modules.jar:1.3.3.Final]       在org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389)[jboss-modules.jar:1.3.3.Final]       在org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134)[jboss-modules.jar:1.3.3.Final]       ......还有15个   19:08:31,657 ERROR [org.jboss.as.controller.management-operation](DeploymentScanner-threads - 2)JBAS014613:操作("完全替换部署")失败 - 地址:([] ) - 失败描述:{" JBAS014671:服务失败" => {" jboss.deployment.unit \" ProjectEngineerServer.jar \" .POST_MODULE" =>服务中的" org.jboss.msc.service.StartException:jboss.deployment.unit。\" ProjectEngineerServer.jar \" .POST_MODULE:JBAS018733:无法处理部署的POST_MODULE阶段\&#34 ; ProjectEngineerServer.jar \"       引起:java.lang.RuntimeException:JBAS018757:使用ClassLoader获取类com.system.main.HandlingBean的反射信息时出错Module && 34; deployment.ProjectEngineerServer.jar:main \"来自服务模块加载器       引起:java.lang.NoClassDefFoundError:com / healthmarketscience / rmiio / RemoteInputStream       引起:java.lang.ClassNotFoundException:com.healthmarketscience.rmiio.RemoteInputStream来自[Module \" deployment.ProjectEngineerServer.jar:main \"来自服务模块加载器]"}}

我不明白为什么找不到课程(com/healthmarketscience/rmiio/RemoteInputStream)。我使用Maven并将其添加到我的 pom.xml

<dependency>
    <groupId>com.healthmarketscience.rmiio</groupId>
    <artifactId>rmiio</artifactId>
    <version>2.0.5</version>
</dependency>

所以我在我的项目中获得了rmiio库。

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。我一步一步地做了什么:

  1. 我在Wildfly_HOME下为rmiio库创建了以下路径:WILDFLY_HOME\modules\system\layers\base\com\healthmarketscience\main
  2. 我在rmiio-2.0.5.jar目录中添加了module.xml文件和main文件。这是module.xml文件:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <module xmlns="urn:jboss:module:1.3" name="com.healthmarketscience">
      <resources>
        <resource-root path="rmiio-2.0.5.jar"/>
      </resources>
      <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
      </dependencies>
    </module>
    
  3. 我在项目的jboss-deployment-structure.xml目录中添加了META-INF个文件。这是jboss-deployment-structure.xml文件:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <jboss-deployment-structure>
        <deployment>
            <dependencies>
                <module name="com.healthmarketscience" slot="main" export="true"/>
            </dependencies>        
        </deployment>
    </jboss-deployment-structure>