NoClassDefFoundError javax / jms / Message even when specifying a class path

I got an error while running certain java code related to JMS. I pulled my hair for 2 days trying to figure it out.

The exception that I get is "java.lang.NoClassDefFoundError: javax / jms / Message"

java.lang.NoClassDefFoundError: javax/jms/Message
    at Asci.ActiveBatch.JMSAgent.JMSManager.createMsg(JMSManager.java:195)
    at Asci.ActiveBatch.JMSAgent.JMSService.SendMessageHandler(JMSService.java:160)

Without going into the LLP in detail, this applies to this line:

public static void createMsg(String icf, String url, String cf, String QName, String msgText, String[] props, String user, String pass) throws Exception {
    JMSProducer.produceMsg(icf, url, cf, QName, msgText, props, user, pass);
}

(Do not ask why this function simply maps to another ... I did not originally write this code)

I call this code as

java -jar /path/myjarfile.jar

javax.jms.jar is included in this jar manifest (and it exists in this place), but just in case, I also tried to include the path to my lib folder (which contains javax.jms.jar, of course) as follows:

java -classpath /path/lib:. -jar /path/myjarfile.jar

. , . . , , ( ) .

.

:

1)   java -classpath/path/lib/javax.jms.jar:. -jar/path/myjarfile.jar

2) , .

3) , , jar, . - . , , ( /), . , - - -.

+5
3

, classloader, javax.jms.Message , , .

JMSManager JMSProducer, - ?

static {
   System.out.println("MESSAGE CLASSLOADER IN JMSMANAGER:" + 
       javax.jms.Message.class.getProtectionDomain().getCodeSource().getLocation());
}

URL-, , javax/jms/Message.class , JMS .

... , , :)

+4

.jar , .

java -classpath /path/lib/JMS.jar:. -jar /path/myjarfile.jar
0

lib WEB-INF, . : javax.jms.jar

0

All Articles