java.lang.ClassNotFoundException 在 SAR 文件中 JBOSS AS 7.1.1

java.lang.ClassNotFoundException in SAR file JBOSS AS 7.1.1

我正在尝试部署 sar 文件,但收到与 java.lang.ClassNotFoundException 相关的错误。 我的 sar 文件是

10:46:27,697 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.mbean.service."backend.actipstation:service=SnmpStationService1".start: org.jboss.msc.service.StartException in service jboss.mbean.service."backend.actipstation:service=SnmpStationService1".start: JBAS017222: Failed to execute legacy service start() method at org.jboss.as.service.StartStopService.start(StartStopService.java:56) 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:1145) [rt.jar:1.7.0_65] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65] Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_65] at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_65] at org.jboss.as.service.AbstractService.invokeLifecycleMethod(AbstractService.java:52) at org.jboss.as.service.StartStopService.start(StartStopService.java:54) ... 5 more Caused by: java.lang.NoClassDefFoundError: org/snmp4j/smi/Variable at cl.auter.sictrav.comunicacion.snmp.backend.SnmpStation.startService(SnmpStation.java:154) at cl.auter.sictrav.comunicacion.snmp.backend.SnmpStationService.start(SnmpStationService.java:11) ... 11 more Caused by: java.lang.ClassNotFoundException: org.snmp4j.smi.Variable from [Module "deployment.sictrav3_actstationservice.sar: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.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] ... 13 more

我的 sar 文件有这个结构

+ actstationservice.sar
|-cl/
    |- /* compiled class files here */
| snmp4j-1.11.1.jar
|-META-INF/
    |- jboss-service.xml
    |- jboss-deployment-structure.xml

jboss-部署-structure.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>  
    <resources>
        <resource-root path="snmp4j-1.11.1.jar"></resource-root>
    </resources>
    <dependencies>
        <module name="org.snmp4j" export="true" />
    </dependencies>
</deployment>
</jboss-deployment-structure>

我的Manifest.MF

Manifest-Version: 1.0
Dependencies: org.snmp4j export,org.hibernate

我在 /lib 文件夹中也有库

我错过了什么?

sar 文件不包含 META-INF 中的 jboss-deployment-structure.xml。我添加了它,它很有魅力。