Solved

NoClassDefFoundError: javax/resource/ResourceExceptioin

Posted on 2009-04-07
5
705 Views
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?
0
Comment
Question by:skendall66
  • 2
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
Gibu George earned 125 total points
Comment Utility
The javax.resource.ResourceException is from J2EE 5 are you using J2EE APIs also?
0
 

Author Comment

by:skendall66
Comment Utility
I am using a set of IBM MQ Series jar files:

com.ibm.mq.jar
com.ibm.mq.jmqi.jar
com.ibm.mqjms.jar

There is a class named com.ibm.mq.MQEnvironment that is throwing the error (MQEnvironment.java:570) when I set some variables in it with code like:

MQEnvironment.channel = "whatever";

the error occurs.
0
 

Author Comment

by:skendall66
Comment Utility

import com.ibm.mq.*;
 
 

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";

			MQEnvironment.channel = "CLIENT_CMP";

			MQEnvironment.port = 1420;

			MQEnvironment.hostname = "Q4DE8PSAE24.blf.telekom.de";

			requestQueueName = "ESB_CRMT_BLT_REQRESERVATIONSTAT.REQ.IN";

			replyQueueName = "POC_REQRESERVATIONSTAT.REPLY.OUT";

	

	

			//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

			//system_default_local_queue.put(hello_world,pmo);

			requestQueue.put(requestMsg,pmo);

			

			

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

			//system_default_local_queue.close();

			requestQueue.close();

			replyQueue.close();

			

			// Disconnect from the queue manager

			requestQMgr.disconnect();

			replyQMgr.disconnect();

			

			

		} 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 (java.io.IOException ex) {

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

			}

		*/

		} // testMQ constructor

} // end of sample

Open in new window

0
 
LVL 12

Assisted Solution

by:Gibu George
Gibu George earned 125 total points
Comment Utility
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
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

743 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

18 Experts available now in Live!

Get 1:1 Help Now