Classload scope when -jar option is specified in Client Applications
 Technote (troubleshooting)
 
Problem(Abstract)
Due to the difference of class load behavior between the Sun Java™ Development Kit (JDK) and the IBM® Software Development Kit (SDK), you might encounter the java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceException exception as a usage scenario when your Web service client application is run with the ibm-jaxrpc-client.jar file.

export WAS_HOME=/opt/IBM/WebSphere/AppServer
${WAS_HOME}/java/jre/bin/java -classpath ${WAS_HOME}/runtimes/ibm-jaxrpc-client.jar -jar Your_Client_Application.jar Your_Client_Application_args


Note: This scenario works with the IBM SDK, but it might not work with the Sun JDK.

For example:
${WAS_HOME}/java/jre/bin/java -classpath ${WAS_HOME}/runtimes/ibm-jaxrpc-client.jar -jar ./bank6Clt.jar bankhost.yamato.ibm.com USD
 
Cause
The class loading specification for the Sun JDK is much more strict than the IBM SDK.
 
Resolving the problem
There are three ways to resolve this problem:
  • Use the -classpath option instead of the -jar option.

    The script is:
    export WAS_HOME=/opt/IBM/WebSphere/AppServer   ${WAS_HOME}/java/jre/bin/java -classpath  {WAS_HOME}/runtimes/ibm-jaxrpc-client.jar:Your_Client_Application.jar main_class_of_your_application Your_Client_Application_args
    :
    For example:
    ${WAS_HOME}/java/jre/bin/java -classpath ${WAS_HOME}/runtimes/ibm-jaxrpc-client.jar:./bank6Clt.jar com.ibm.gvt.bank.client.RateQueryClient bankhost.yamato.ibm.com USD


  • Use the -Djava.ext.dirs option with the -jar option.

    The script is:
    export WAS_HOME=/opt/IBM/WebSphere/AppServer    ${WAS_HOME}/java/jre/bin/java -Djava.ext.dirs=${WAS_HOME}/runtimes -jar Your_Client_Application.jar Your_Client_Application_args

    For example:
    ${WAS_HOME}/java/jre/bin/java -Djava.ext.dirs=${WAS_HOME}/runtimes -jar ./bank6Clt.jar bankhost.yamato.ibm.com USD


  • Modify Class-Path in MANIFEST.MF to include all needed JAR files:

    Class-Path: /opt/IBM/WebSphere/AppServer/runtimes/ibm-jaxrpc-client.jar

    For example (note the change of the JAR file to one with new MANIFEST.MF):
    export WAS_HOME=/opt/IBM/WebSphere/AppServer    ${WAS_HOME}/java/jre/bin/java -jar ./bank6Clt.jar bankhost.yamato.ibm.com USD
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Classloader
Operating system(s): Solaris
Software version: 6.0.2
Software edition:
Reference #: 1209597
IBM Group: Software Group
Modified date: Jun 27, 2005