Ich versuche, eine SAR-Datei bereitzustellen, aber ich bekomme einen Fehler im Zusammenhang mit java.lang.ClassNotFoundException. Meine sar Datei istjava.lang.ClassNotFoundException in SAR-Datei JBOSS AS 7.1.1
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
Meine sar Datei diese Struktur hat
+ actstationservice.sar
|-cl/
|- /* compiled class files here */
| snmp4j-1.11.1.jar
|-META-INF/
|- jboss-service.xml
|- jboss-deployment-structure.xml
jboss-Deployment-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>
Mein MANIFEST.MF
Manifest-Version: 1.0
Dependencies: org.snmp4j export,org.hibernate
Außerdem habe ich die Bibliothek innerhalb/lib Ordner
Was vermisse ich?
Die sar-Datei enthielt nicht die jboss-deployment-structure.xml in META-INF. Ich fügte es hinzu und arbeitete als ein Charme. – Jebus