Results 1 to 8 of 8
  1. #1
    Kareng is offline Member
    Join Date
    Aug 2009
    Posts
    35
    Rep Power
    0

    Default how to resolve java.lang.NoClassDefFoundError?

    Dear forum members,

    I'm trying hard to set up this CheckOutExpress.java in order to make this paypal SOAP work.

    However, after debugging, I get the following error from Netbean IDE:

    java.lang.NoClassDefFoundError: org/apache/axis/encoding/AnyContentType
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :621)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader .java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader. java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 52)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:320)
    Caused by: java.lang.ClassNotFoundException: org.apache.axis.encoding.AnyContentType
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 52)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:320)
    ... 12 more
    Could not find the main class:

    abc.servlet.SetExpressCheckoutService. Program will exit.
    Exception in thread "main" Java Result: 1

    I hope someone can advise me how to rectify the above error.

    Many thanks!

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default Re: how to resolve java.lang.NoClassDefFoundError?

    The jar file containing this class:
    org.apache.axis.encoding.AnyContentType

    is not on the runtime classpath.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Kareng is offline Member
    Join Date
    Aug 2009
    Posts
    35
    Rep Power
    0

    Default Re: how to resolve java.lang.NoClassDefFoundError?

    Hi Toll,

    Thanks. I've added the axis.war file under the library as well.

    Now, my problem is that I think I'm suppose to be able to right-click on my project's name, and the a Axis2 on Java will appear.

    But, none can be found. The closer thing is Web Service and Web Service Client.

    Can I know what steps I have to do in order to have Axis2 on Java appear on the list?

    Many thanks.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default Re: how to resolve java.lang.NoClassDefFoundError?

    I have no idea what you are talking about?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Kareng is offline Member
    Join Date
    Aug 2009
    Posts
    35
    Rep Power
    0

    Default Re: how to resolve java.lang.NoClassDefFoundError?

    OK. Let me try again.

    Here's the message:

    asically, I have tried to use paypal SOAP Api which means using Web Services.

    After including the Axis2.war file under the library folder of my project and setting things up including putting this line at the target location for the Axis2 .aar files:

    C:\Program Files\NetBeans 6.8\apache-tomcat-6.0.20_base\ShoppingCart\axis2


    According to the Axis2 Web Service by NetBean, I am suppose to be able to get this Axis2 Service from Java when I clicked on my project's name.

    However, I can't find Axis2 Service from Java at all!

    Hope someone can advise me on that and my next question is whether the above step will generate a client for WSDL and xsd files?

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,856
    Rep Power
    19

    Default Re: how to resolve java.lang.NoClassDefFoundError?

    I have no idea how Netbeans does these things.
    I tend to write my WSDL and generate the base project from that.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    Join Date
    Mar 2011
    Posts
    93
    Rep Power
    0

    Default Re: how to resolve java.lang.NoClassDefFoundError?

    Is the org/apache/axis/encoding/AnyContentType file something you have already written.

    If it is a project/class you have already written, you can add it to the Library of your current project by right-clicking the Project Library (in NetBeans Properties/projects window) and selecting "Add Project", "Add Library", or "Add JAR/Folder".

    You then also need an import statement referencing the org/apache/axis/encoding/AnyContentType
    thing in your code.

    I'm having a similar problem. See separate post.

  8. #8
    Kareng is offline Member
    Join Date
    Aug 2009
    Posts
    35
    Rep Power
    0

    Default Re: how to resolve java.lang.NoClassDefFoundError?

    Hi Humphrey,

    I just read that it's not necessary to use Axis at all.
    You can use JAX-WS instead. Read that at Javan-Ranch after googling.

    However, I hope not to mis-led you 'cos I'm still very green in this area.

Similar Threads

  1. java.lang.NoClassDefFoundError
    By BoomPony in forum New To Java
    Replies: 8
    Last Post: 01-05-2011, 05:36 PM
  2. Replies: 5
    Last Post: 06-02-2010, 01:05 PM
  3. Replies: 3
    Last Post: 06-01-2010, 03:01 PM
  4. Replies: 2
    Last Post: 09-18-2008, 07:30 AM
  5. java.lang.NoClassDefFoundError
    By fred in forum Advanced Java
    Replies: 3
    Last Post: 08-01-2007, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •