• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.lang.NoClassDefFound When Running Samples - New to Java

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
first very sorry I posted this to the beginners java group as it appears to be strightforward. However I though someone from this forum may be more specific with a resolution.

I am sorry if this has been asked a thousand times but....

1. I have installed AXIS 1.3 and all seems well i.e. I can view the happyaxis.jsp page and all the relevant jars are there.

2. As a post install activity I tried to run some of the web samples provided in the "Consuming Web Services with AXIS" section of the users guide. (samples\userguide\example1\TestClient.class) i.e. java samples.userguide.example1.TestClient

3. When I do this I get the "java.lang.NoClassDefFound" error.

4. I had assumed this meant the environment was looking for something it couldn't find, so as part of the java command I added the "-cp" switch followed by all the jar files referenced in the AXISCLASSPATH path i.e. axis.jar, activation.jar, ........

5. Same Error

Can someone inform me of what could be mising?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error should state which class it's missing - that's a crucial piece of information for investigating this problem. Could it be that it's actually the TestClient class that is not in the classpath?
 
Lenin_Tony
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure what you mean? Do you mean I should add the location of my compiled class into the class path?

The exact error I get from executing from command line is

Exception in thread main java.lang.NoclassDefFoundError: samples/userguide/example1/TestClient

As I say any help greatly appreciated.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the classpath should contain all (or most) of the Axis jar files, as well as the TestClient class. Most likely that means that you need to add %TOMCAT_HOME%/webapps/axis/WEB-INF/classes to your classpath.
 
Lenin_Tony
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again. However the problem persists. Here is the exact syntax of what I am trying to execute. I am executing here from the location of the .class file.

E:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\classes\samples\userguide\example1>java -cp ".;E:\Program Files\Java\AXIS\axis-1_3\lib\axis.jar;E:\Program Files\Java\AXIS\axis-1_3\lib\commons-discovery.jar; E:\Program Files\Java\AXIS\axis-1_3\lib\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;E:\Program Files\Java\AXIS\axis-1_3\lib\saaj.jar;E:\Program Files\Java\AXIS\axis-1_3\lib\log4j-1.2.8.jar;E:\Program Files\Java\AXIS\axis-1_3\lib\xml-apis.jar;E:\Program Files\Java\AXIS\axis-1_3\lib\xercesImpl.jar"
samples.userguide.example1.TestClient
Exception in thread "main" java.lang.NoClassDefFoundError: samples/userguide/example1/TestClient
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do a "cd ..\..\.." and then execute the very same command. You should read up on the concept of Java packages and the concept of classpaths - then you'll understand what's going on.
 
Lenin_Tony
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right I should, and will.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic