jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Varma, Nitesh" <nitesh_va...@tvworks.com>
Subject NoClassDefFoundError - please help
Date Fri, 05 May 2006 15:40:47 GMT
I'm a newbie to Cactus and getting my feet wet.

Has anybody had problem with their Cactus test unable to instantiate the Servlet under test
on the server side? I'll greatly appreciate any help /
hint. 

I came across NoClassDefFoundError issues on cactus-users mail archive, but my issue is different.

My cactified EAR file contains the Servlet WAR file and cactus.war file (which contains the
Cactus test cases). The test's beginXXX() method executes
file, but when it enters the testXXX() method and tries to instantiate the Servlet to test,
I get the following exception:

14:13:19,951 INFO  [STDOUT] java.lang.NoClassDefFoundError: com/liberate/vod/web/TVPV7FrontServlet
14:13:19,952 INFO  [STDOUT]at com.liberate.vod.web.test.MyServletTest.testGetRootFolder(MyServletTest.java:59)
14:13:19,952 INFO  [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:13:19,952 INFO  [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:13:19,952 INFO  [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:13:19,952 INFO  [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
...

I used the following to cactify my ear file:

<cactifyear srcfile="${cactify.dir}/${project.name}.ear" destfile="${cactify.dir}/${project.name}-cactified.ear">
  <cactuswar context="/cactus" version="2.3">
       <classes dir="${cactify.dir}/test/classes">
          <include name="**/*Test.class"/>
       </classes>
  </cactuswar>
</cactifyear>

This generates cactus.war with the following structure:

WEB-INF\classes\com\liberate\vod\web\test\MyServletTest.class
WEB-INF\lib +
            |-aspectrjt-1.2.1.jar
            |-cactus-1.7.1.jar
            |-commons-logging-1.0.4.jar
            |-junit-3.8.1.jar
WEB-INF\web.xml

Clearly, my ServletTestCase is not able to reference the Servlet under test, even though they
are under the same EAR file (different WAR file though -
Servlet is in application WAR and test is in cactus war). So I don't know if there are classloader
issues involved, and if so, then how to get rig=d
of them.

Thanks,

Nitesh

Mime
View raw message