Jboss 7.1.1:找不到NamingException类

时间:2014-05-26 07:40:31

标签: java rest jboss

此RESTservice项目部署在带有Liferay SDK 6.2的Jboss 7.1.1上。 'javax.api'已被添加为jboss-deployment-structure.xml的依赖项,但无论如何都会出现此错误:

    09:11:28,741 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."RESTtest.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."RESTtest.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "RESTtest.war"
    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(Unknown Source) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_51]
Caused by: java.lang.RuntimeException: Error getting reflective information for class de.foo.soa.myfoo.sales.MyfooSalesSF with ClassLoader ModuleClassLoader for Module "de.foo.soa.myfoo.modules:main" from local module loader @41c61c91 (roots: C:\fooTest\liferay-portal-JBOSS6.2-ce-ga2\jboss-7.1.1\modules)
    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: javax/naming/NamingException
    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_51]
    at java.lang.Class.privateGetDeclaredFields(Unknown Source) [rt.jar:1.7.0_51]
    at java.lang.Class.getDeclaredFields(Unknown Source) [rt.jar:1.7.0_51]
    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: javax.naming.NamingException from [Module "de.foo.soa.myfoo.modules:main" from local module loader @41c61c91 (roots: C:\fooTest\liferay-portal-JBOSS6.2-ce-ga2\jboss-7.1.1\modules)]
    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.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]
    ... 15 more

09:11:28,748 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "RESTtest.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"RESTtest.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"RESTtest.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"RESTtest.war\""}}
09:11:28,757 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment RESTtest.war in 9ms
09:11:28,758 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."RESTtest.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."RESTtest.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "RESTtest.war"

在javax / api的module.xml中看一下,javax / naming / NamingException被添加为依赖项,所以一切都应该没问题:

        <dependencies>
        <system export="true">
            <paths>
                ...
                <path name="javax/naming"/>
                <path name="javax/naming/directory"/>
                <path name="javax/naming/event"/>
                <path name="javax/naming/ldap"/>
                <path name="javax/naming/spi"/>
                ...
            </paths>
        </system>
    </dependencies>

我期待任何建设性的建议。

1 个答案:

答案 0 :(得分:1)

您似乎已将javax api依赖项添加到部署的jboss-deployment-structure.xml中,但是如果您查看异常消息:

ClassNotFoundException: javax.naming.NamingException from
    [Module "de.foo.soa.myfoo.modules:main"

“de.foo.soa.myfoo.modules”模块中缺少它,而不是来自您的部署。模块module.xml文件是您需要添加依赖项的地方。