Consultor Eletrônico



Kbase 21696: SonicMQ: java.lang.NoClassDefFoundError: javax/naming/Ref...
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   23/01/2002
SUMMARY:

This Solution applies to SonicMQ Version 4.0 on UNIX. You might see the following message when trying to run the SonicMQ samples using SonicMQ.sh:

java.lang.NoClassDefFoundError: javax
aming/Referenceable

EXPLANATION:

When you install SonicMQ Version 4.0 on UNIX in console mode, you will find that although starting the SonicMQ broker works fine, trying to run one of the examples (for instance, the Chat example) found in the $SONICMQ_HOME/samples directory using the SonicMQ.sh script, produces the following stack trace:

# ../../SonicMQ.sh Chat -u test
Exception in thread "main" java.lang.NoClassDefFoundError: javax
aming/Referenceable
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:477)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:109)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$1(URLClassLoader.java:216)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:298)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:285)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:477)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:109)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)

SOLUTION:

The problem is that within SonicMQ.sh, the archive containing the javax
aming package is not included in the classpath.

Adding:

$SONICMQ_LIB/jndi.jar

to the line for setting the environment variable:

SONICMQ_CLASSPATH

within the script SonicMQ.sh, solves the problem since it contains the classes for the javax
aming package.

Example:

SONICMQ_CLASSPATH=$SONICMQ_LIB/sonic_Client.jar${ps}$SONICMQ_LIB/jndi.jar${ps}$SONICMQ_LIB/gnu-regexp-1.0.6.jar${ps}$SONICMQ_LIB/jaxp.jar${ps}$SONICMQ_LIB/xerces.jar${ps}$SONICMQ_LIB/swingall.jar${ps}$SONICMQ_SSL_LIB${ps}$SONICMQ_LIB/tools.jar


References to Written Documentation:

SonicMQ Installation Configuration and Administration Guide