5 Replies Latest reply on Apr 4, 2011 2:22 PM by V M

    I am getting java.lang.NoClassDefFoundError: Even though the Class is in  the war.

    S C Newbie

      I have myclass in the two wars which are part of the ear. However when myclass is invoked. I am getting the following Error/Exception. The myclass is present in the both the wars.

       

      Caused by: java.lang.ClassNotFoundException: from BaseClassLoader@15390b7{vfszip:/opt/sw/jboss/jboss/jboss-eap-5.0.1/jboss-as/server/server501/deploy/my.ear/} at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:477) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

       

      Please let us know how could we solve the issue. Jboss5.0.1 and JDK1.6 are being used.

       

      Your responses are highly appriciated.

       

      -SC

        • 1. I am getting java.lang.NoClassDefFoundError: Even though the Class is in  the war.
          S C Newbie

          Detail Stacktrace.

           

          2011-03-31 13:27:16,614 SEVERE [javax.enterprise.resource.webservices.jaxws.server.PeptTie] com/myclass java.lang.NoClassDefFoundError: com/myclass at com/myclass1(com/myclass1.java:263) at com/myclass2(com/myclass2.createZipFile(Unknown Source) at com/myclass2.publish(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.xml.ws.server.PeptTie._invoke(PeptTie.java:58) at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.invokeEndpoint(SOAPMessageDispatcher.java:254) at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(SOAPMessageDispatcher.java:547) at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:140) at com.sun.xml.ws.server.Tie.handle(Tie.java:88) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.handle(WSServletDelegate.java:279) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:232) at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:77) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at com.jamonapi.http.JAMonTomcatValve.invoke(JAMonTomcatValve.java:72) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.ClassNotFoundException: com.myclass from BaseClassLoader@15390b7{vfszip:/opt/sw/jboss/jboss/jboss-eap-5.0.1/jboss-as/server/server501/deploy/my.ear/} at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:477) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

          • 2. I am getting java.lang.NoClassDefFoundError: Even though the Class is in  the war.
            Peter Johnson Master

            Eacatly where are the classes com.myclass1 and com.myclass located? If com.myclass1 is not in the WAR, but com.class is in the WAR, then com.myclass1 will not have access to com.myclass. This is according to the servlet spec which indicates that classes within a WAR are isolated and not accessible from outside the WAR.

            • 3. Re: I am getting java.lang.NoClassDefFoundError: Even though the Class is in  the war.
              S C Newbie

              Thanks a lot for your response.

               

              In my case all the all the three classes are in the same war i.e com.myclass, com.myclass1 and com.myclass2 are all in the same war in the WEB-INF\classes.

               

              Even though all the classes are in the same war we are getting the error/exception Secondly com.myclass and com.myclass2  have got the @WebService annotations,  com.myclass invoked in an utility class com.myclass1 and this utility class has refrence to  com.myclass2. Is this problem comes due to @WebService  link or any other problem.

               

              Even though all the classes are in the same war, The war is packed inside an ear we are getting the error.

               

              indddtion we are setting the following in the Jboss-web.xml

               

               

               

               

               
               
              com.sun.xml.ws.loader:loader=my-webservices.war
               java2ParentDelegaton=true  
               
               
              
              

              Your response is highly appriciated.

              • 4. Re: I am getting java.lang.NoClassDefFoundError: Even though the Class is in  the war.
                Peter Johnson Master

                Why did you define a loader repository -n jboss-web.xml? Most likely you do not need this.

                 

                Please post the conmtents of you WAR. You can get the contents by running:

                 

                jar -tf /path/to/the.war

                • 5. I am getting java.lang.NoClassDefFoundError: Even though the Class is in  the war.
                  V M Newbie

                  This loader repository has been used to get rid of the Class Loading issues which was clashing with the Jboss 5.0.1 server libraries. To avoid the Deploy time exceptions we had to include this configuration so that all the com.sun.xml.ws.loader jars are loaded from our specific war file instead of Jboss server library jars... but now even though the Class is reciding inside the war, we get Class notFound exception.