You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mike Straw <ms...@columbus.rr.com> on 2005/12/08 17:25:11 UTC

Axis handler and Java NoClassDefFoundError problem

I'm having a problem with my Axis handler and a pesky JAVA
NoClassDefFoundError error.

Here is the background.  I'm using Axis 1.2.1 with tomcat 5.5.9 on a Windows
XP machine.  I deployed a simple service, created a simple client
application and was able to connect to that service; no problem.

Next, I created a simple Axis handler (in package a.b) for use by both the
simple service and simple client, I updated client and server WSDD files,
redeployed the server, deployed the client and added the handler class file
to

	tomcat/axis/WEB-INF/classes/a/b/simple_handler.class
and
	<simple_client_dir>/a/b/simple_handler.class

Everything worked great!  I was beginning to think I actually was smarter
than I looked ... WRONG!


I needed to add functionality to the simple handler; functionality that was
contained in a JAR file called complex.jar, which had the structure
x/y/*.class (i.e., all java code in complex.jar was in package x.y).

I updated simple_handler, copied the resulting simple_handler.class file to
the appropriate directories, added complex.jar to my AXISCLASSPATH and
CLASSPATH, restarted tomcat and reran my simple client.  My simple client
and the simple_handler.class invoked on the client side worked great. But,
the simple_handler running under tomcat came back with the class not found
error shown below (bottom of email).

complex.jar was found by the handler when running under the simple client,
why couldn't it be found when running under the simple server?  I use a .bat
file to set my AXISCLASSPATH and CLASSPATH, so both client and tomcat should
have the same environment.

Any help is appreciated.



Thanks,

Mike Straw
mstraw@columbus.rr.com



... tomcat startup info ...
INFO: Server startup in 3078 ms
- Exception:
java.lang.NoClassDefFoundError: x/y/complexException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:176)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
        at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getJavaClass(WSDDDeployab
leItem.java:353)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeplo
yableItem.java:295)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeploy
ableItem.java:274)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployabl
eItem.java:260)
        at
org.apache.axis.deployment.wsdd.WSDDDeployment.getHandler(WSDDDeployment.jav
a:394)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeploy
ableItem.java:276)

... lots more ...



RE: Axis handler and Java NoClassDefFoundError problem

Posted by Mike Straw <ms...@columbus.rr.com>.
Thanks for the reply.  
 
#3a seemed to do the trick (put JAR files in the axis/WEB-INF/lib
directory).   I put complex.jar in that directory and updated AXISCLASSPATH
and CLASSPATH to just include complex.jar without any leading path.  Life is
beautiful once again.
 
Mike

-----Original Message-----
From: Soactive Inc [mailto:soactive@gmail.com] 
Sent: Thursday, December 08, 2005 11:50 AM
To: axis-user@ws.apache.org; mstraw@columbus.rr.com
Subject: Re: Axis handler and Java NoClassDefFoundError problem


I can think of 3 things:

1. Make sure you have the package names correctly specified at the beginning
of each Java file in question.

2. Its preferred that you bundle up all class files within .jar files (if
possible).

3a) Place all the necessary jar files under axis/WEB-INF/lib since it uses
that as the base class path for libraries  at boot time.

3b) Place all the necessary class files under axis/WEB-INF/classes (follow
the same path as the package names - so a class called a.b.C needs to be
placed under WEB-INF/classes/a.b) since it uses that as the base classes
path for classes at boot time.

Hope that helps,
-Arun


On 12/8/05, Mike Straw <ms...@columbus.rr.com> wrote: 

I'm having a problem with my Axis handler and a pesky JAVA
NoClassDefFoundError error.

Here is the background.  I'm using Axis 1.2.1 with tomcat 5.5.9 on a Windows
XP machine.  I deployed a simple service, created a simple client 
application and was able to connect to that service; no problem.

Next, I created a simple Axis handler (in package a.b) for use by both the
simple service and simple client, I updated client and server WSDD files, 
redeployed the server, deployed the client and added the handler class file
to

        tomcat/axis/WEB-INF/classes/a/b/simple_handler.class
and
        <simple_client_dir>/a/b/simple_handler.class 

Everything worked great!  I was beginning to think I actually was smarter
than I looked ... WRONG!


I needed to add functionality to the simple handler; functionality that was
contained in a JAR file called complex.jar, which had the structure
x/y/*.class (i.e., all java code in complex.jar was in package x.y).

I updated simple_handler, copied the resulting simple_handler.class file to
the appropriate directories, added complex.jar to my AXISCLASSPATH and
CLASSPATH, restarted tomcat and reran my simple client.  My simple client
and the simple_handler.class invoked on the client side worked great. But,
the simple_handler running under tomcat came back with the class not found 
error shown below (bottom of email).

complex.jar was found by the handler when running under the simple client,
why couldn't it be found when running under the simple server?  I use a .bat
file to set my AXISCLASSPATH and CLASSPATH, so both client and tomcat should

have the same environment.

Any help is appreciated.



Thanks,

Mike Straw
mstraw@columbus.rr.com



... tomcat startup info ...
INFO: Server startup in 3078 ms 
- Exception:
java.lang.NoClassDefFoundError: x/y/complexException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at org.apache.axis.utils.ClassUtils$2.run (ClassUtils.java:176)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
        at org.apache.axis.utils.ClassUtils.forName (ClassUtils.java:100)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getJavaClass(WSDDDeployab
leItem.java:353)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeplo

yableItem.java:295)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeploy
ableItem.java:274)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployabl

eItem.java:260)
        at
org.apache.axis.deployment.wsdd.WSDDDeployment.getHandler(WSDDDeployment.jav
a:394)
        at
org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeploy
ableItem.java:276)

... lots more ...






Re: Axis handler and Java NoClassDefFoundError problem

Posted by Soactive Inc <so...@gmail.com>.
I can think of 3 things:

1. Make sure you have the package names correctly specified at the beginning
of each Java file in question.

2. Its preferred that you bundle up all class files within .jar files (if
possible).

3a) Place all the necessary jar files under axis/WEB-INF/lib since it uses
that as the base class path for libraries  at boot time.

3b) Place all the necessary class files under axis/WEB-INF/classes (follow
the same path as the package names - so a class called a.b.C needs to be
placed under WEB-INF/classes/a.b) since it uses that as the base classes
path for classes at boot time.

Hope that helps,
-Arun

On 12/8/05, Mike Straw <ms...@columbus.rr.com> wrote:
>
> I'm having a problem with my Axis handler and a pesky JAVA
> NoClassDefFoundError error.
>
> Here is the background.  I'm using Axis 1.2.1 with tomcat 5.5.9 on a
> Windows
> XP machine.  I deployed a simple service, created a simple client
> application and was able to connect to that service; no problem.
>
> Next, I created a simple Axis handler (in package a.b) for use by both the
> simple service and simple client, I updated client and server WSDD files,
> redeployed the server, deployed the client and added the handler class
> file
> to
>
>         tomcat/axis/WEB-INF/classes/a/b/simple_handler.class
> and
>         <simple_client_dir>/a/b/simple_handler.class
>
> Everything worked great!  I was beginning to think I actually was smarter
> than I looked ... WRONG!
>
>
> I needed to add functionality to the simple handler; functionality that
> was
> contained in a JAR file called complex.jar, which had the structure
> x/y/*.class (i.e., all java code in complex.jar was in package x.y).
>
> I updated simple_handler, copied the resulting simple_handler.class file
> to
> the appropriate directories, added complex.jar to my AXISCLASSPATH and
> CLASSPATH, restarted tomcat and reran my simple client.  My simple client
> and the simple_handler.class invoked on the client side worked great. But,
> the simple_handler running under tomcat came back with the class not found
> error shown below (bottom of email).
>
> complex.jar was found by the handler when running under the simple client,
> why couldn't it be found when running under the simple server?  I use a
> .bat
> file to set my AXISCLASSPATH and CLASSPATH, so both client and tomcat
> should
> have the same environment.
>
> Any help is appreciated.
>
>
>
> Thanks,
>
> Mike Straw
> mstraw@columbus.rr.com
>
>
>
> ... tomcat startup info ...
> INFO: Server startup in 3078 ms
> - Exception:
> java.lang.NoClassDefFoundError: x/y/complexException
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:242)
>         at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:176)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
>         at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
>         at
> org.apache.axis.deployment.wsdd.WSDDDeployableItem.getJavaClass
> (WSDDDeployab
> leItem.java:353)
>         at
> org.apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance
> (WSDDDeplo
> yableItem.java:295)
>         at
> org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance
> (WSDDDeploy
> ableItem.java:274)
>         at
> org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance
> (WSDDDeployabl
> eItem.java:260)
>         at
> org.apache.axis.deployment.wsdd.WSDDDeployment.getHandler(
> WSDDDeployment.jav
> a:394)
>         at
> org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance
> (WSDDDeploy
> ableItem.java:276)
>
> ... lots more ...
>
>
>