NoClassDefFoundError (initialization failure) - Websphere and IBM MQ

Alex picture Alex · Jan 27, 2011 · Viewed 40.1k times · Source

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)

Answer

Brett Kail picture Brett Kail · Jan 28, 2011

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.)