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

I added a web service using Axis2 to my project, and now I can not start my application.

This is the class path 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 goal that is fulfilled 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
+3
source share
4 answers

If you use tomcat, copy all the jar files located in the axis2 / lib folder to the tomcat / lib folder, and also add them to the class path, such as D: \ axis2-1.6.2 \ lib *

+5
source

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

axis2-kernel-1.6.2 , , wsdl2java.bat.

, 2-jars classpath .

,

+1

. .

eclipse Runnable Jar ( - > Export- > Runnable Jar) , . JAR, .

Jar eclipse Jar, . , Jar.

0

JBoss, .

The most important part is to define the new module in the JBoss module configurations, and also find the module in your MANIFEST.MF file.

Maven will help you do the later part. The following is an example configuration for adding an axis module to a manifest file.

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <configuration>
                <archive>
                    <manifestEntries> <!--Manually added JBoss Modules (that are not found by JBoss class loader) must be loaded here-->
                        <Dependencies>axis.axis</Dependencies>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>

Depending on the type of packaging, you should use other maven plugins, such as maven-jar-plugin or maven-war-plugin.

The name of the dependency package must match the name you specified for the name of your module in JBoss modules. The axis module described above is defined in JBoss models as described in the links above.

 <module xmlns="urn:jboss:module:1.1" name="axis.axis">
    <properties>
        <property name="jboss.api" value="private"/>
    </properties> 
 <!--  ...   -->
 </module>
0
source

All Articles