java.lang.NoClassDefFoundError: org/apache/axis2/client/Stub

28,169

Solution 1

If you are using tomcat, copy all the jar files located under axis2/lib folder to the tomcat/lib folder and also add them to the classpath like this D:\axis2-1.6.2\lib*

Solution 2

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/client/Stub

Above error can be removed by adding axis2-kernel-1.6.2 to the class path, but you might start getting other errors after you have generated the stubs with wsdl2java.bat.

So you better add all the axis2-jars to classpath while compiling the client.

Hope this helps

Share:
28,169
user1314836
Author by

user1314836

Updated on July 12, 2022

Comments

  • user1314836
    user1314836 almost 2 years

    I've added a Web Service using Axis2 to my project and now I can't run my application.

    This is the classpath I am using:

    <property name="classpath" location="bin:EventReservationCore/bin:EventReservationCore/db:EventReservationCore/lib/*:EventReservationCore/lib/util_iso2.jar:EventReservationCore/lib/sqlitejdbc-v056.jar:AuthorizationRMI/lib/AuthorizationService.jar:EventReservationCore/lib/activemq-all-5.4.3.jar:/home/ander/axis2-1.6.1/webapp/axis2.war"/>
    

    And this is the target that runs until I add the Axis2 Web Service.

    <target name="run.besocial">
                <java classname="eventReservationServer.ReservationEventServer" classpath="${classpath}" fork="true">
                    <jvmarg value="-Djava.rmi.server.codebase=file:EventReservationCore/bin/ file:EventReservationCore/lib/util_iso2.jar"/>
                    <jvmarg value="-Djava.security.policy=EventReservationCore/java.policy" />
                </java>
        </target>
    

    As a result I get this error:

     [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/client/Stub
     [java]     at java.lang.ClassLoader.defineClass1(Native Method)
     [java]     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
     [java]     at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
     [java]     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
     [java]     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
     [java]     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
     [java]     at eventReservationServer.eventServerGateway.WSEventServerGateway.getEvents(WSEventServerGateway.java:19)
     [java]     at eventReservationServer.ReservationEventServer.<init>(ReservationEventServer.java:101)
     [java]     at eventReservationServer.ReservationEventServer.main(ReservationEventServer.java:130)
     [java] Caused by: java.lang.ClassNotFoundException: org.apache.axis2.client.Stub
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
     [java]     ... 15 more