ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » java.lang.NoClassDefFoundError: com/ibm/mq/MQException

Post new topic  Reply to topic
 java.lang.NoClassDefFoundError: com/ibm/mq/MQException « View previous topic :: View next topic » 
Author Message
TheDude
PostPosted: Mon Oct 21, 2002 8:48 am    Post subject: java.lang.NoClassDefFoundError: com/ibm/mq/MQException Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

I am trying to execute an MQPut program in Binding mode. The code compiles cleanly but I get:
java.lang.NoClassDefFoundError: com/ibm/mq/MQException
when I try to execute.

Here is my Classpath and Path respectively:
%MQ_JAVA_INSTALL_PATH%;%J2EE_HOME%\lib\j2ee.jar;
C:\Program Files\IBM\Application Developer Integration Edition\jre\lib;
C:\j2sdk1.4.1\bin\;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CTGCLIENT.JAR;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CTGSERVER.JAR;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CICSJ2EE.JAR;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CTGSAMPLES.JAR;%TOMCAT%\lib\servlet.jar;
C:\Program Files\IBM\MQSeries\Java\lib;
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.iiop.jar;
C:\Program Files\IBM\MQSeries\Java\lib\connector.jar;
C:\Program Files\IBM\MQSeries\Java\samples\base




PATH
%J2EE_HOME%\lib\j2ee.jar;.;
%TOMCAT_HOME%\webapps\sampleWEB-INF\classes;
%SYSTEMROOT%\SYSTEM32;
%SystemRoot%;%SystemRoot%\System32\Wbem;
C:|j2sdk1.4.1\bin;
C:\TNGSD\BIN;C:\Program Files\IBM\Trace Facility;
C:\Program Files\Personal Communications;
C:\Program Files\MQSeries\tools\c\samples\bin;
C:\Program Files\MQSeries\bin;
C:\Program Files\IBM\IBM CICS Transaction Gateway\BIN;
C:\j2sdk1.4.1\bin\;
%CLASSPATH%;
C:\Program Files\IBM\MQSeries\Java\lib


I am running on Win2k with MQSeries 5.2 and MA88. I know this must be a CLASSPATH issue but I cannot figure out where.


Pleeeaase Heeelp!
Back to top
View user's profile Send private message
bower5932
PostPosted: Mon Oct 21, 2002 9:13 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

This is probably caused by jta.jar or connector.jar not being in your classpath. You can search this site and you should find a hit that can tell you exactly which one.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
TheDude
PostPosted: Mon Oct 21, 2002 9:40 am    Post subject: Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

I added jta.jar to my CLASSPATH and it still doesn't work. What else could I be missing? Thanks for your help.

CLASSPATH
%J2EE_HOME%\lib\j2ee.jar;
C:\Program Files\IBM\Application Developer Integration Edition\jre\lib;
C:\j2sdk1.4.1\bin\;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CTGCLIENT.JAR;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CTGSERVER.JAR;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CICSJ2EE.JAR;
C:\Program Files\IBM\IBM CICS Transaction Gateway\Classes\CTGSAMPLES.JAR;
%TOMCAT%\lib\servlet.jar;
C:\Program Files\IBM\MQSeries\Java\lib;
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.iiop.jar;
C:\Program Files\IBM\MQSeries\Java\lib\connector.jar;
C:\Program Files\IBM\MQSeries\Java\samples\base;
C:\Program Files\IBM\MQSeries\Java\lib\jta.jar
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Mon Oct 21, 2002 8:15 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Ya, but where is com.ibm.mqbind.jar ?

later
Roger...
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
nimconsult
PostPosted: Mon Oct 21, 2002 10:42 pm    Post subject: Reply with quote

Master

Joined: 22 May 2002
Posts: 268
Location: NIMCONSULT - Belgium

Hi "TheDude",

I do not see your problem in the CLASSPATH, I have the following CLASSPATH which works successfully:

CLASSPATH=
.;
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;
C:\Program Files\IBM\MQSeries\Java\lib\connector.jar;
C:\Program Files\IBM\MQSeries\Java\lib\jta.jar;
C:\Program Files\IBM\MQSeries\Java\lib;
C:\Program Files\JASMQ\lib\be.nimconsult.jasmq.jar;
C:\Program Files\JASMQ\lib\be.nimconsult.queue.jar;
C:\Program Files\JASMQ\samples\bin

I suppose that you are sure of your installation path?

I do not think that adding com.ibm.mqbind.jar to CLASSPATH is the problem. In fact the documentation recommends to avoid using it.

The problem might come from your path which looks very complex: you are adding the CLASSPATH content in the PATH variable? I am not sure that Windows appreciates seeing JAR files in the path. Could you simplify it and only include the "C:\Program Files\IBM\MQSeries\Java\lib" folder?
_________________
Nicolas Maréchal
Senior Architect - Partner

NIMCONSULT Software Architecture Services (Belgium)
http://www.nimconsult.be
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bower5932
PostPosted: Tue Oct 22, 2002 10:31 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

For what it is worth, here is my CLASSPATH:

set classpath=.;
c:\mqseries\java\lib\com.ibm.mqbind.jar;
c:\MQseries\java\lib\com.ibm.mq.jar;
c:\MQseries\java\lib\com.ibm.mqjms.jar;
c:\MQSeries\java\lib\jms.jar;
c:\mqseries\java\lib\jndi.jar;
c:\mqseries\java\lib;
c:\mqseries\java\lib\providerutil.jar;
c:\mqseries\java\lib\fscontext.jar;
c:\mqseries\java\lib\jta.jar;
c:\mqseries\java\lib\connector.jar;

I'd suggest moving the CTG jar files to the end of your CLASSPATH. Although, this shouldn't make a difference.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
RogerLacroix
PostPosted: Tue Oct 22, 2002 6:38 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

I don't want to start a war but I strongly disagree with 2 points from Nicolas' post.

First, com.ibm.mqbind.jar IS required to do binding mode connection to a queue manager (not required for client mode).

Secondly, C:\Program Files\IBM\MQSeries\Java\lib (just the directory - not jar files) IS required to be in the Windows PATH for binding mode because the Java\lib directory has the required MQ DLL (e.g mqjbnd04.dll - MA88 April 2002).

I just did a test of removing com.ibm.mqbind.jar from my classpath and tried to connect in binding mode to a queue manager. Here is the error that I got:
Code:
java.lang.NoClassDefFoundError: com/ibm/mq/MQException

"TheDude", hope that helps.

later
Roger...
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
nimconsult
PostPosted: Tue Oct 22, 2002 11:02 pm    Post subject: Reply with quote

Master

Joined: 22 May 2002
Posts: 268
Location: NIMCONSULT - Belgium

Hello Roger,

I do not want to make war neither

First regarding the PATH variable, I do not see where we disagree because I said the same thing. The lib folder MUST be in the PATH and I asked TheDude to remove the references to all jar files from the PATH.

Regarding com.ibm.mqbind.jar, I am honnestly surprised that you cannot run without it. I do not have this jar file in my classpath and it works perfectly. May be have we installed different versions of the MA88 support pac? Mine is released 31Mar02 (see readme.txt).

I read the "MQ Series using Java" manual, ninth edition (February 2002) and it textually says (at the beginning of Chapter 2, installation procedure):

Quote:
com.ibm.mq.jar: This code includes support for all the connection options.
com.ibm.mqbind.jar: this code supports only the bindings connection and is not supplied or supported on all platforms. We recommend that you do not use it in any new applications.


No war but I would like to have your opinion on the question: is com.ibm.mqbind.jar required in the classpath?

With Kind Regards ,
_________________
Nicolas Maréchal
Senior Architect - Partner

NIMCONSULT Software Architecture Services (Belgium)
http://www.nimconsult.be
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TheDude
PostPosted: Wed Oct 23, 2002 7:04 am    Post subject: Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

All,

Thank you so much for all of your input, you have helped tremendously. I have edited my PATH and CLASSPATH variables and now everything works like a charm(these things are very tempermental).

PATH:
C:\Program Files\IBM\MQSeries\Java\lib;
C:\j2sdk1.4.1\bin\;


CLASSPATH:
.;
%J2EE_HOME%\lib\j2ee.jar;
%TOMCAT%\lib\servlet.jar;
C:\Program Files\IBM\Application Developer Integration Edition\jre\lib;
C:\j2sdk1.4.1\bin\;
C:\Program Files\IBM\MQSeries\Java\lib\;
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.jar;
C:\Program Files\IBM\MQSeries\Java\lib\com.ibm.mq.iiop.jar;
C:\Program Files\IBM\MQSeries\Java\lib\connector.jar;
C:\Program Files\IBM\MQSeries\Java\samples\base\;
C:\Program Files\IBM\MQSeries\Java\lib\jta.jar;
C:\Program Files\IBM\MQSeries\Java\lib\fscontext.jar;
C:\Program Files\IBM\MQSeries\Java\lib\jndi.jar

I think I may even be able to omit iiop.jar,fscontext.jar and jndi.jar but I'll try that later. Once again, thanks to all of you.

BTW, do any of you know how big the message buffer for the MQMessage object is ? I am receiving quite a large reply from my message client and I get a java.io.EOFException. I'm assuming that the size of the message buffer in the MQMessage object needs to be increased.

Thanks.
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Oct 23, 2002 12:46 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

My two cents on mqbind.jar...I just took it out of my classpath and my program worked correctly. I vaguely remember that with the first release of MQ java, you had to specify either client or bindings jar files. MQ wasn't able to figure out what you were doing. However, I thought that a later release required just the mq.jar and MQ would figure out if it had to load the mqbind.jar. There may have been a comment in one of the iterations of the Using Java manual that is long gone by now.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
RogerLacroix
PostPosted: Wed Oct 23, 2002 9:28 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Hi,

My com.ibm.mq.jar (and others) are dated 2002/03/29.

I just did a "binding mode" test again and if I remove mqbind.jar then I get the error. (Win2000 platform)

I would agree with IBM's comment, because MA88 for OS/390 (USS) does not have mqbind.jar file.

Bower, in your Java app., how did you connect to the queue manager? Client or binding mode? (e.g. Did you specify hostname/port#/channel name). What platform did you test on?

later
Roger...
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
nimconsult
PostPosted: Wed Oct 23, 2002 10:47 pm    Post subject: Reply with quote

Master

Joined: 22 May 2002
Posts: 268
Location: NIMCONSULT - Belgium

Hi Roger,

Strange?

I am also running W2K Professional, MQ5.2, MA88 dated March 2002. My com.ibm.mq.jar and com.ibm.mqbind.jar are also dated 2002-03-29.

I connect in binding mode, using standard base Java coding, and it works perfectly:

Code:
try
{
   MQQueueManager qm = new MQQueueManager("");

   MQQueue q = qm.accessQueue("LQ.TEST", MQC.MQOO_OUTPUT);

   MQMessage m = new MQMessage();

   m.writeString("Hello World");
   m.format = MQC.MQFMT_STRING;

   q.put(m);

   q.close();

   qm.disconnect();
}
catch (MQException e)
{
   System.out.println("MQ Error: " + e);
}


My classpath is the one I posted earlier.

What else could be different?
_________________
Nicolas Maréchal
Senior Architect - Partner

NIMCONSULT Software Architecture Services (Belgium)
http://www.nimconsult.be
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bower5932
PostPosted: Thu Oct 24, 2002 10:09 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

My program is a JMS program. I'm using one of two TCFs. One uses a transport of CLIENT and the other uses a transport of BIND. I'm running on a Windows 2000 machine with MQ 5.2.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
bower5932
PostPosted: Thu Oct 24, 2002 10:15 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

I just tried it with straight java in both client and bindings mode. I didn't need to have the mqbind.jar in my classpath to get it to work.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
kingdon
PostPosted: Fri Oct 25, 2002 12:19 am    Post subject: Reply with quote

Acolyte

Joined: 14 Jan 2002
Posts: 63
Location: UK

Hi,

The com.ibm.mqbind.jar is a little piece of history. In early releases an application would either import the com.ibm.mqbind.* classes to connect via bindings, or the com.ibm.mq.* classes to connect via a client. Later releases made the connection configurable at runtime so that it wasn't necessary to recompile an application just to switch connection type. Both routes are now supported via com.ibm.mq. The com.ibm.mqbind.jar file that ships with current releases is just a thin wrapper back to com.ibm.mq so that old applications written to the com.ibm.mqbind package can still be run without changes. I would recommend all new applications to be written to the com.ibm.mq package. If you have an old application in production using com.ibm.mqbind then you might get a small performance improvement by updating it to use com.ibm.mq.

Cheers,
James.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » java.lang.NoClassDefFoundError: com/ibm/mq/MQException
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.