1 Reply Latest reply on Nov 6, 2003 2:23 AM by martin_kersten

    [Cactus] NoClassDefFoundError

    martin_kersten Newbie

      Hello,

      I am currently stuck trying to testing using Cactus. I am allways getting NoClassDefFoundError in my test-cases.

      The error occures on class ServletTestCase of package org.apache.cactus:

      void init(Test theTest)
      {
      -> setClientDelegate(new WebClientTestCaseDelegate(
      this, theTest, new ServletConfiguration())); <-
      setServerDelegate(new ServerTestCaseDelegate(this, theTest));
      }

      The value theTest of is null.

      The marked (-> ... <-) line crashes. I think it is a classloader caused error.

      I tried for two days now, and I couldn't get any solution... . I hope you guys can help me... .

      I am running JBoss 3.2.2 using JDK 1.4.2 and developing using Eclipse and MyEclipse. CPU: AMD XP 2000+ & 512MB DDR.


      Big Thanks,

      Martin


      PS: Here is the log stack trace:

      2003-11-05 18:32:31,656 ERROR [org.apache.cactus.server.AbstractWebTestCaller] Error instantiating class [org.ocsn.bariel.tables.SqlTableTest([testCreateDropIsExisting], [null])]
      java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
      at org.apache.cactus.server.AbstractWebTestCaller.getTestClassInstance(AbstractWebTestCaller.java:413)
      at org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:148)
      at org.apache.cactus.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:130)
      at org.apache.cactus.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:151)
      at org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:138)
      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:151)
      at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:109)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:151)
      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: java.lang.NoClassDefFoundError
      at org.apache.cactus.ServletTestCase.init(ServletTestCase.java:188)
      at org.apache.cactus.ServletTestCase.(ServletTestCase.java:153)
      at org.ocsn.ServletTestCase.(ServletTestCase.java:12)
      at org.ocsn.DBTestCase.(DBTestCase.java:14)
      at org.ocsn.bariel.tables.SqlTableTest.(SqlTableTest.java:9)
      ... 56 more

        • 1. Re: [Cactus] NoClassDefFoundError
          martin_kersten Newbie

          I finally managed to find a solution.

          First of all, I forgot to add Class-Path: cactus-... .jar to MANIFEST.FM of my ejb and web subprojects deployed within the same ear.

          Second a new NoClassDefFoundError occured. A org.apache.commons.http... class was missing. Therefore I had to add the libraries of cactus/client to the jboss/server/myserver/lib.

          Now everthing is working and I am amazed, I can cross-test the classes of the web and ear archive. (meaning I can test ejb classes on protected level within the web subproject and vise versa). Yeah ;)