1 Reply Latest reply on Aug 8, 2008 10:05 AM by Jose Alvarez de Lara

    ClassNotFoundException in an ear application

    Vamsi Nukala Newbie

      This might be a fundamental question:
      I have a singleton class: SpringContext in a jar: context.jar and is initialiazed by a InitServlet. This servlet is defined in web.xml and loaded from WEB-INF/classes. During

      init(ServletConfig..),
      the spring beans container is inited with few beans.

      However, I have a jar that resides under myapp.ear directory which cannot access the ContextLoader class that was already inited during Servlet load time.

      How can I successfully use it in a class defined in the jar under myapp.ear?
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      The actual error log is shown here:
      2008-07-21 16:18:18,812 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/myApp/xyz]]
      Exception while dispatching incoming RPC call
      com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String
      com.mysoftware.myApp.gwt.client.MyImpl.getSpringBeanByName(java.lang.String,java.lang.String)'
      threw an unexpected exception: java.lang.NoClassDefFoundError: com/mysoftware/myApp/InitServlet
      at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:361)
      at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:547)
      at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:265)
      at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:187)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      ...
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NoClassDefFoundError: com/mysoftware/myApp/InitServlet
      at com.mysoftware.myApp.dao.ResourceHeaderDAO.loadHeaders(ResourceHeaderDAO.java:993)
      at com.mysoftware.myApp.dao.ResourceHeaderDAO.loadAllHeaders(ResourceHeaderDAO.java:582)
      at com.mysoftware.myApp.gwt.server.MyImpl.getSpringBeanByName(MyImpl.java:79)
      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.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:528)
      ... 24 more
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.mysoftware.myApp.MyServletContext
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:292)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      ... 32 more


      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Thanks,
      Vamsi