NoClassDefFoundError: javax/resource/ResourceExceptioin

Posted on 2009-04-07
Last Modified: 2012-05-06
I have compiled successfully a small java program on a Solaris 10 box. When run I get the exception in thread main stuff and the NoClassDefFound in the title. What am I missing in my java environment?
Question by:skendall66
  • 2
  • 2
LVL 12

Accepted Solution

Gibu George earned 125 total points
ID: 24087938
The javax.resource.ResourceException is from J2EE 5 are you using J2EE APIs also?

Author Comment

ID: 24088031
I am using a set of IBM MQ Series jar files:

There is a class named that is throwing the error ( when I set some variables in it with code like: = "whatever";

the error occurs.

Author Comment

ID: 24088054


public class testMQ {


	// settings for sean kendall's pc local MQ Series tests:

	String requestQManager = "";

	String requestQueueName = "";

	String replyQManager = "";

	String replyQueueName = "";


	public static void main(String args[]) {

		new testMQ();



	public testMQ() {

		try {

			// The Using Java with MQ Series pdf states that channel must be set to

			// the channel name (String) and port to the port number (int) the MQ Series

			// server is listening on


			// settings for sean kendall's pc local MQ Series tests:

			//requestQManager = "QM_SKENDALL";

			//requestQueueName = "SYSTEM.DEFAULT.LOCAL.QUEUE";

			//MQEnvironment.hostname = "localhost";


			// settings for THome's MQ environment:

			String requestQManager = "I2MMA1"; = "CLIENT_CMP";

			MQEnvironment.port = 1420;

			MQEnvironment.hostname = "";





			//IMPORTANT: all the settings above must be completed befor declaring a new MQQueueManager


			//declare qManagers

			MQQueueManager requestQMgr; 

			MQQueueManager replyQMgr; 



			// Create a connection to the queue managers

			requestQMgr = new MQQueueManager(requestQManager);

			replyQMgr = new MQQueueManager(replyQManager);


			// Set up the options on the queue we wish to open...

			// Note. All MQSeries Options are prefixed with MQC in Java.

			int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ;


			// Now specifythe queue that we wish to open,

			// and the open options...

			//MQQueue system_default_local_queue = requestQMgr.accessQueue(requestQueueName, openOptions);

			MQQueue requestQueue = requestQMgr.accessQueue(requestQueueName, openOptions);

			MQQueue replyQueue = replyQMgr.accessQueue(replyQueueName, openOptions);


			// Define a simple MQSeries message, and write some text in UTF format..

			//MQMessage hello_world = new MQMessage();

			MQMessage requestMsg = new MQMessage();

			MQMessage replyMsg = new MQMessage();


			//hello_world.writeUTF("Hello World!");

			requestMsg.writeUTF("Give Me Something Back");


			// specifythe message options...

			MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the defaults, same as MQPMO_DEFAULT

			// put the message on the queue





			// Set the get message options...

			MQGetMessageOptions gmo = new MQGetMessageOptions(); // accept the defaults

			// same as MQGMO_DEFAULT

			// get the message off the queue...

			//system_default_local_queue.get(retrievedMessage, gmo);

			replyQueue.get(replyMsg, gmo);



			// And prove we have the message bydisplay ing the UTF message text

			String msgText = replyMsg.readUTF();

			System.out.println("The message is: " + msgText);

			// Close the queue...





			// Disconnect from the queue manager





		} catch (Exception e) {

			System.out.println("An exception occurred: " + e.toString());




			// If an error has occurred in the above, tryto identifywhat went wrong

			// Was it an MQSeries error?

			catch (MQException ex) {

				System.out.println("An MQSeries error occurred : Completion code " +

				ex.completionCode + " Reason code " + ex.reasonCode);


			// Was it a Java buffer space error?

			catch ( ex) {

				System.out.println("An error occurred whilst writing to the message buffer: " + ex);



		} // testMQ constructor

} // end of sample

Open in new window

LVL 12

Assisted Solution

by:Gibu George
Gibu George earned 125 total points
ID: 24088080
I think the MQ series API uses the J2EE framework, so you need to have the j2ee api jar files also in you class path for execution

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 77
Java JRE greater than 1.6 5 51
session migration servlets 2 28
Oracle SQL syntax check  without executing 6 38
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now