1 Reply Latest reply on Aug 20, 2007 9:32 AM by ssilvert

    JSF Unit classpath

    oren1

      Hi,

      Since there is no User Forum, I will post my question here.

      I get the exception below while trying to perform tests. I made sure that the test class is in the classpath (internal jar, under web-inf/lib).
      The error still occurs. cactus.jar is in classpath (otherwise org.apache.cactus messages would not apear). I am using Sun-RI.

      Thanks,
      Oren

      Aug 19, 2007 8:59:23 AM org.apache.cactus.internal.server.AbstractWebTestCaller getTestClassClass
      SEVERE: Error finding class [redsea.conf.test.users.MACAddressTest] using both the Context classloader and the webapp classloader. Possible causes include:
      - Your webapp does not include your test classes,
      - The cactus.jar is not located in your WEB-INF/lib directory and your Container has not set the Context classloader to point to the webapp one
      java.lang.ClassNotFoundException: redsea.conf.test.users.MACAddressTest
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:242)
      at org.apache.cactus.internal.util.ClassLoaderUtils.loadClassFromContextClassLoader_aroundBody2(ClassLoaderUtils.java:78)
      at org.apache.cactus.internal.util.ClassLoaderUtils.loadClassFromContextClassLoader_aroundBody3$advice(ClassLoaderUtils.java:264)
      at org.apache.cactus.internal.util.ClassLoaderUtils.loadClassFromContextClassLoader(ClassLoaderUtils.java)
      at org.apache.cactus.internal.util.ClassLoaderUtils.loadClass_aroundBody0(ClassLoaderUtils.java:61)
      at org.apache.cactus.internal.util.ClassLoaderUtils.loadClass_aroundBody1$advice(ClassLoaderUtils.java:264)
      at org.apache.cactus.internal.util.ClassLoaderUtils.loadClass(ClassLoaderUtils.java)
      at org.apache.cactus.internal.server.AbstractWebTestCaller.getTestClassClass(AbstractWebTestCaller.java:485)
      at org.apache.cactus.internal.server.AbstractWebTestCaller.getTestClassInstance(AbstractWebTestCaller.java:409)
      at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:109)
      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
      at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
      at org.jboss.jsfunit.framework.JSFUnitCactusRedirector.doPost(JSFUnitCactusRedirector.java:67)
      at org.jboss.jsfunit.framework.JSFUnitCactusRedirector.doGet(JSFUnitCactusRedirector.java:78)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
      at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
      at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:595)
      A

        • 1. Re: JSF Unit classpath
          ssilvert

          Hi,

          I'm not planning to open up a user forum until beta is ready. In the mean time, feel free to post here with any question you might have.

          What you are seeing is a Cactus error that is not actually related to JSFUnit. I did a quick search and came up with a couple of possible solutions from other users of Cactus.

          "FYI: The error below happened because my tomcat was already running when I started the ant run-tests."
          http://www.gridlab.org/pipermail/gridsphere-dev/2003-November/000732.html

          "The other possibility is that you have the cactus jar or some cactus-related jar in the system class (check that you CLASSPATH environment variable is empty)."
          http://osdir.com/ml/jakarta.cactus.user/2005-02/msg00059.html

          Of course, you should also double-check to make sure that your test class exists in a jar in WEB-INF/lib, or exploded in WEB-INF/classes. Plus, make sure that the cactus jar is in WEB-INF/lib and not on your classpath.

          Failing that, see http://jakarta.apache.org/cactus/integration/manual/howto_classpath.html for the definitive guide to setting the Cactus classpath.

          This appears unrelated to your problem, but the last bit of advice is to upgrade to a newer version of JSFUnit. From the stack trace I see that you are using the old JSFUnitCactusRedirector. We have replaced this with a JSFUnitFilter class.

          The Getting Started Guide shows the new declarations you will need in web.xml. It also has a link to the updated (and renamed) version of the JSFUnit core jar. You will also need the JTidy jar which can also be downloaded from the Getting Started Guide. The URL for the guide is:
          http://labs.jboss.com/jsfunit/gettingstarted.html

          Hope that helps. Please check back and let us know how it is going.

          Regards,

          Stan Silvert
          http://www.jsfunit.org