Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoClassDefFoundError (initialization failure) - Websphere and IBM MQ

Im having a problem on a Spring based webapp that is being deployed to Websphere and interacts with IBM MQ.

All is fine until I try some failure tests.

While the webapp is up and running, I stop IBM MQ. I then invoke the webapp to send a JMS message out. The webapp hung at the call to JmsTemplate.convertAndSend and the following exception was found in the ffdc directory.

Note the JmsTemplate was initialised using the JNDIObjectFactoryBean where it had got the MQ Connection Factory settings from Websphere.

Can anyone explain the reason behind the "Initializaton Failure" ??

[27/01/11 14:29:39:498 GMT]     FFDC Exception:java.lang.NoClassDefFoundError SourceId:com.ibm.ws.asynchbeans.J2EEContext.run ProbeId:894 Reporter:com.ibm.ws.asynchbeans.J2EEContext@1280128
java.lang.NoClassDefFoundError: com.ibm.msg.client.wmq.common.internal.Reason (initialization failure)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
        at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1024)
        at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:997)
        at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:63)
        at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.initialise(WMQMessageProducer.java:758)
        at com.ibm.msg.client.wmq.internal.WMQMessageProducer.<init>(WMQMessageProducer.java:972)
        at com.ibm.msg.client.wmq.internal.WMQSession.createProducer(WMQSession.java:943)
        at com.ibm.msg.client.jms.internal.JmsSessionImpl.createProducer(JmsSessionImpl.java:1162)
        at com.ibm.msg.client.jms.internal.JmsQueueSessionImpl.createSender(JmsQueueSessionImpl.java:131)
        at com.ibm.mq.jms.MQQueueSession.createSender(MQQueueSession.java:148)
        at com.ibm.mq.jms.MQQueueSession.createProducer(MQQueueSession.java:249)
        at com.ibm.ejs.jms.JMSMessageProducerHandle.<init>(JMSMessageProducerHandle.java:132)
        at com.ibm.ejs.jms.JMSSessionHandle.createProducer(JMSSessionHandle.java:1788)
        at org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:968)
        at org.springframework.jms.core.JmsTemplate.createProducer(JmsTemplate.java:949)
        at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:568)
        at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:541)
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)
        at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539)
        at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:617)
like image 319
Alex Avatar asked Jan 27 '11 16:01

Alex


2 Answers

The "(initialization failure)" means that the static initializer ("<clinit>") method of the class previously threw an unchecked exception. When this occurs, the JVM marks the class as bad, and subsequent attempts to use or access the class result in NoClassDefFoundError. Search your logs for errors that include "Reason.<clinit>" in the stack trace to find the underlying cause.

(In general, the NoClassDefFoundError should include a "Caused by" with the exception that occurred in the static initializer, but for some reason, the cause either wasn't present or you didn't include it in your stack trace.)

like image 59
Brett Kail Avatar answered Nov 03 '22 13:11

Brett Kail


It does look like a message catalog is missing. I'm reading the stack dump as the thrown exception (NoClassDefFound) is trying to access something in it's constructor. The missing class may be the actual cause or the missing message may be hiding the actual exception, depending on how it was thrown of course. Can you put a catch block in and manually walk the nested exceptions?

Even if this exception isn't part of a nested exception, it could also mean it was instantiated inside a catch block of an unknown exception. I wouldn't expect that issue in IBM's MQ code but you never know.

like image 1
Kelly S. French Avatar answered Nov 03 '22 13:11

Kelly S. French