4 Replies Latest reply on Jun 10, 2010 12:19 PM by plasmoid

    java.lang.NoClassDefFoundError

    plasmoid

      I'm having a problem getting JSFUnit running in WebLogic 10.3.

       

      I have JSFUnit and I'm trying to access it via a URL and I'm getting an error:

       

       

      Error 500--Internal Server Error

      java.lang.NoClassDefFoundError: junit/framework/TestResult
           at org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.java:281)
           at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody0(ServletTestRunner.java:186)
           at org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody1$advice(ServletTestRunner.java:224)
           at org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunner.java)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
           at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:159)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
           at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
           at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
           at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
           at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
           at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

       

       

      Now, I'm confused about this since I have junit-3.8.1.jar in the WEB-INF/lib of my application class path.  Has anyone encountered anything like this before?  Should I try to install junit.jar in the system classpath of my WebLogic installation?

        • 1. Re: java.lang.NoClassDefFoundError
          ssilvert

          That is strange.  I'd also check to make sure that the JUnit jar is not corrupted and that it really does contain that class.

           

          Stan

          1 of 1 people found this helpful
          • 2. Re: java.lang.NoClassDefFoundError
            plasmoid

            I've checked the jar file and it is fine but I think I have found the problem.

             

            If I include cactus-13-1.7.1.jar in my EJB project then I get the error.  If I leave out that jar, it works fine.  If I include cactus in a different, non-EJB, project then it works fine.

             

            Do you know if the cactus jar does any weird class loading?  Do I need to create a special library folder to follow along with my EJB to make it work correctly?

            • 3. Re: java.lang.NoClassDefFoundError
              ssilvert

              I don't think you are seeing a problem with Cactus.  Your problem is with classloading between two different classloaders.

               

              If you are doing Cactus (non-JSFUnit) tests on your EJB then I suggest packaging the Cactus jar at the EAR level only.  That way the same cactus/classloader combo is used by the enitre EAR.  You will have to be careful to make sure that Cactus dependencies are also only packaged at the EAR level.

               

              If you are not doing Cactus  (non-JSFUnit) tests on your EJB then keep everything in WEB-INF/lib.

               

              Stan

              • 4. Re: java.lang.NoClassDefFoundError
                plasmoid

                I think you're right.  I found a solution, I added junit to my application's library path which allowed cactus to load the necessary classes.