You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Srikrishna Kalavacharla <sr...@hotmail.com> on 2003/12/05 02:18:18 UTC

Beginner - NoClassDefFoundError

Hi All,
I've tried my best to read through the mailing lists and implement all the 
suggestions, but still I'm getting the same error.

My Error is
(java.lang.NoClassDefFoundError
at org.apache.cactus.ServletTestCase.init(ServletTestCase.java:188)
at org.apache.cactus.ServletTestCase.<init>(ServletTestCase.java:164) ...

I'm using the eclipse integration from the nightly build area and the plugin 
is
C:\eclipse\plugins\org.apache.cactus.eclipse.runner_1.6dev-20031029.  I'm 
using JBoss as my application server.

My EAR file has got the following Structure

TestCactus.ear
    application.xml
    TestCactus.jar
        com
            cactus
                TestCactusHome.class
                TestCactusBean.class
                TestCactus.class
        META-INF
            jboss.xml
            ejb-jar.xml
    TestCactus.war
         WEB-INF
             jboss-web.xml
             web.xml
             lib
                 log4j-1.2.8.jar
                 junit-3.8.1.jar
                 commons-logging-1.0.1.jar
                 cactus-1.6dev-20031029.jar
                 aspectjrt-1.1.1.jar
             classes
                 com
                     cactus
                         TestCactusHome.class
                         TestCactusBean.class
                         TestCactus.class
                         TestCactusTest.class

In the client side I've the following jar files

junit-3.8.1.jar
cactus-ant-1.6dev-20031029.jar
commons-httpclient-2.0-rc2.jar
aspectjrt-1.1.1.jar
commons-logging-1.0.3.jar
httpunit-1.5.3.jar
cactus-1.6dev-20031029.jar

I've the mappings for ServletRedirector and ServletTestRunner in my web.xml. 
  When I try the ServletRedirector page it shows me the blank page and I 
assume there are no errors in the process.  However when I use the 
ServletTestRunner and call the com.cactus.TestCactusTest class it throws me 
a class not found error.

Please let me know where I'm doing wrong.


Thanks
Srikrishna

_________________________________________________________________
Winterize your home with tips from MSN House & Home. 
http://special.msn.com/home/warmhome.armx


Re: Beginner - NoClassDefFoundError

Posted by Christopher Lenz <cm...@gmx.de>.
Hi Srikrishna,

you need to remove the TestCactus.jar from the EAR, so that the test 
classes only appear in the web-app. Otherwise the test classes are 
loaded from a class-loader one level above the class-loader that loads 
cactus.jar, thus resulting in the NCDFE you're getting.

Hope that helps,
   Chris
--
Christopher Lenz
/=/ cmlenz at gmx.de

Am 05.12.2003 um 02:18 schrieb Srikrishna Kalavacharla:
> Hi All,
> I've tried my best to read through the mailing lists and implement all 
> the suggestions, but still I'm getting the same error.
>
> My Error is
> (java.lang.NoClassDefFoundError
> at org.apache.cactus.ServletTestCase.init(ServletTestCase.java:188)
> at org.apache.cactus.ServletTestCase.<init>(ServletTestCase.java:164) 
> ...
>
> I'm using the eclipse integration from the nightly build area and the 
> plugin is
> C:\eclipse\plugins\org.apache.cactus.eclipse.runner_1.6dev-20031029.  
> I'm using JBoss as my application server.
>
> My EAR file has got the following Structure
>
> TestCactus.ear
>    application.xml
>    TestCactus.jar
>        com
>            cactus
>                TestCactusHome.class
>                TestCactusBean.class
>                TestCactus.class
>        META-INF
>            jboss.xml
>            ejb-jar.xml
>    TestCactus.war
>         WEB-INF
>             jboss-web.xml
>             web.xml
>             lib
>                 log4j-1.2.8.jar
>                 junit-3.8.1.jar
>                 commons-logging-1.0.1.jar
>                 cactus-1.6dev-20031029.jar
>                 aspectjrt-1.1.1.jar
>             classes
>                 com
>                     cactus
>                         TestCactusHome.class
>                         TestCactusBean.class
>                         TestCactus.class
>                         TestCactusTest.class
>
> In the client side I've the following jar files
>
> junit-3.8.1.jar
> cactus-ant-1.6dev-20031029.jar
> commons-httpclient-2.0-rc2.jar
> aspectjrt-1.1.1.jar
> commons-logging-1.0.3.jar
> httpunit-1.5.3.jar
> cactus-1.6dev-20031029.jar
>
> I've the mappings for ServletRedirector and ServletTestRunner in my 
> web.xml.  When I try the ServletRedirector page it shows me the blank 
> page and I assume there are no errors in the process.  However when I 
> use the ServletTestRunner and call the com.cactus.TestCactusTest class 
> it throws me a class not found error.
>
> Please let me know where I'm doing wrong.
>
>
> Thanks
> Srikrishna


Re: Beginner - NoClassDefFoundError

Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi.

Thu, 04 Dec 2003 19:18:18 -0600,
"Srikrishna Kalavacharla" <sr...@hotmail.com> wrote: 
sricredstat> My Error is
sricredstat> (java.lang.NoClassDefFoundError
sricredstat> at org.apache.cactus.ServletTestCase.init(ServletTestCase.java:188)
sricredstat> at org.apache.cactus.ServletTestCase.<init>(ServletTestCase.java:164) ...
...
sricredstat> My EAR file has got the following Structure

Try put commons-httpclient-rc2.jar in TestCactus.ear/TestCactus.war/WEB-INF/lib.
What will hapened?

I don't use eclipse, but it may same situation as I reported.
# See "Cactus-1.5 requires commons-httpclient.jar in server side"
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp