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 » Linux/WebsphereMQ 5.3 & java.lang.NoClassDefFoundError

Post new topic  Reply to topic
 Linux/WebsphereMQ 5.3 & java.lang.NoClassDefFoundError « View previous topic :: View next topic » 
Author Message
TheDude
PostPosted: Thu Oct 30, 2003 3:05 pm    Post subject: Linux/WebsphereMQ 5.3 & java.lang.NoClassDefFoundError Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

I have written a java "Queue Cleaner" application in WSAD 5.0 on a Windows 2000 box to remove un-processed messages from a reply queue. I have MQ 5.3 on my Windows box - I tested the app and it works fine. However, when I deploy the class on to my Red Hat Linux AS 2.1 box, it blows up with:
java.lang.NoClassDefFoundError: com/ibm/mq/MQException

I have set my $PATH equal to the following:
bash: /opt/IBMJava2-:/usr/X11R6/bin:
/usr131/jre/bin:/usr/local/bin:/bin:/usr/bin
/local/netscape:/home/brian/bin:/usr/local/netscape:
/opt/mqm/java/lib/com.ibm.mq.jar:
/opt/mqm/java/lib/connector.jar:
/opt/mqm/java/lib/jta.jar:
/opt/IBMJava2-131/bin: No such file or directory

I am assuming that the JVM should be able to track down com.ibm.mq.jar, but obviously not. Am I missing something in the Linux setup for MQ?

Thank You.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Oct 30, 2003 7:31 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Why are you putting .jar files on your $PATH, when java will look for them on your $CLASSPATH?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
TheDude
PostPosted: Fri Oct 31, 2003 8:41 am    Post subject: Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

Because PATH is concatenated in the CLASSPATH variable
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Oct 31, 2003 10:33 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

echo your CLASSPATH and see if MQ jar files are present in the CLASSPATH or not. NoClassDefFoundError is always because of CLASSPATH problem. Your CLASSPATH is not right.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TheDude
PostPosted: Fri Oct 31, 2003 10:39 am    Post subject: Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

Here is my $CLASSPATH:

/opt/mqm/java/lib/com.ibm.mq.jar:
.:
/opt/mqm/java/lib/connector.jar:
/opt/mqm/java/lib/jta.jar:
/opt/mqm/java:
/opt/mqm/java/lib/:
/opt/mqm/java/lib/libmqjbnd05.so
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Oct 31, 2003 10:47 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Are the jar files really there in that location?
How are you running this app? Are you running this app under WSAD?
Are you running this app under a different user?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TheDude
PostPosted: Fri Oct 31, 2003 10:56 am    Post subject: Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

Yes. MQ 5.3 is installed on this machine and all of the jars are in /opt/mqm/java/lib. I am not using WSAD on this box - I developed the app using WSAD on a Windows machine and exported the class file to Linux. Therefore, I'm executing the program using:

java QueueCleaner QMnger Queue

Breaking News: Now the the JVM seems to be able to find the jar files but it is blowing up with:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no mqjbnd05 (libmqjnd05.so) in java.library.path

As you can see from my $CLASSPATH, I've included the libmqjbnd05.so, but it's complaining about the following:

java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:127)
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Oct 31, 2003 11:02 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Have you set the environment variable LD_LIBRARY_PATH

Set it to LD_LIBRARY_PATH=install_dir/mqm/java/lib
In your case it should be
LD_LIBRARY_PATH=/opt/mqm/java/lib

-------
Venny
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TheDude
PostPosted: Fri Oct 31, 2003 11:13 am    Post subject: Reply with quote

Apprentice

Joined: 21 Oct 2002
Posts: 31

You're definitley getting me closer Venny. Here is what happened:

java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:127)
at java.util.jar.JarFile.<init>(JarFile.java:138)
at java.util.jar.JarFile.<init>(JarFile.java:80)
at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:526)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:491)
at sun.misc.URLClassPath$2.run(URLClassPath.java:287)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:276)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:249)
at sun.misc.URLClassPath.getResource(URLClassPath.java:162)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:675)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:238)
at java.lang.ClassLoader.loadClass(ClassLoader.java:513)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:440)
at java.lang.ClassLoader.loadClass(ClassLoader.java:445)
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java:142)
at com.ibm.mq.MQEnvironment.<clinit>(MQEnvironment.java:283)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:651)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:400)
at QueueCleaner.main(QueueCleaner.java:22)
MQJE001: Completion Code 2, Reason 2035


I wonder if it's because I have libmqjbnd05.so in my CLASSPATH?
Back to top
View user's profile Send private message
vennela
PostPosted: Fri Oct 31, 2003 11:41 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Quote:
I wonder if it's because I have libmqjbnd05.so in my CLASSPATH?

AFAIK this shouldn't matter.

2035 means you have authorities problem. If you do dspmqaut on the MQ object you will know whether or not you have the right authorities.
Code:
Usage: dspmqaut [-m QMgrName] [-n ObjName] -t ObjType [-p Principal | -g Group]

If your user-id is abcd then
dspmqaut -m QMnger -t qmgr -p abcd
If you want to set authorities
setmqaut -m QMnger -t qmgr -p qbcd +all
Similarly for the queue
setmqaut -m QMnger -n Queue -t queue -p abcd +all

It should be OK for testing purposes to give full authorities to the MQ objects.

-------
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Linux/WebsphereMQ 5.3 & java.lang.NoClassDefFoundError
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.