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 "Taylor,Timothy L." <tt...@mitre.org> on 2002/03/01 20:47:35 UTC

NoClassDefFoundError Trying to Test Filter

All,

I'm trying to use cactus 1.2 to test a filter in the Oracle OC4J app
server, which is actually Orion (1.5.x, I believe).  I've followed the
getting started guide correctly, in terms of setting up the server side
classpath, but I've been unable to get this test to work.

Here's my setup:
- I'm deploying a web application archive (WAR) in an EAR file.
- The WAR file has the following layout:
WEB-INF
  |- web.xml [contains entries for the cactus redirectors]
  |- classes [My classes under test and test classes
  |- lib
     |- cactus.jar
     |- junit.jar
     |- log4j-core.jar

When I run the junit test from my ANT build file, the test report that
is generated contains the following error:

  <testcase name="testDoFilter" time="1.202">
    <error message="org/apache/cactus/FilterTestCase"
type="org.apache.cactus.client.ServletExceptionWrapper">java.lang.NoClassDefFoundError:
org/apache/cactus/FilterTestCase
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
        at
com.evermind.naming.ContextClassLoader.findClass(ContextClassLoader.java:273)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:290)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:120)
        at
org.apache.cactus.server.AbstractTestCaller.getTestClassClass(AbstractTestCaller.java:331)
        at
org.apache.cactus.server.AbstractTestCaller.getTestClassInstance(AbstractTestCaller.java:302)
        at
org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.java:130)
        at
org.apache.cactus.server.AbstractTestController.handleRequest(AbstractTestController.java:122)
        at
org.apache.cactus.server.FilterTestRedirector.doFilter(FilterTestRedirector.java:119)
        at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:382)
        at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:177)
        at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)
        at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)
        at
com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
</error>
  </testcase>

The cactus server log file contains the following entries: [Formatting
altered slightly to improve readability]

17:42:40,005 [ApplicationServerThread] DEBUG
server.AbstractTestCaller       -  
 
>getTestClassInstance([org.mitre.metrics.security.TestAuthenticationFilter], [testDoFilter]) 
17:42:40,005 [ApplicationServerThread] DEBUG
server.AbstractTestCaller       - Classloaders =       [ClassLoader:
   
[[C:\Oracle\iSuites\j2ee\home\applications\metrics\metrics\WEB-INF\lib/cactus.jar],
    
[C:\Oracle\iSuites\j2ee\home\applications\metrics\metrics\WEB-INF\lib/junit.jar],
    
[C:\Oracle\iSuites\j2ee\home\applications\metrics\metrics\WEB-INF\lib/log4j-core.jar],
    
[C:\Oracle\iSuites\j2ee\home\applications\metrics\metrics\WEB-INF\lib/parser.jar],
    
[C:\Oracle\iSuites\j2ee\home\applications\metrics\metrics\WEB-INF\classes]]],
  [ClassLoader:
    [[C:\Oracle\iSuites\j2ee\home\lib],
     [C:\Oracle\iSuites\j2ee\home\lib/classes12.jar]]],  
  java.net.URLClassLoader@72380,
  sun.misc.Launcher$AppClassLoader@71732b,
  sun.misc.Launcher$ExtClassLoader@7fdcde 
17:42:40,005 [ApplicationServerThread] DEBUG
server.AbstractTestCaller       -  
 
>getTestClassClass([org.mitre.metrics.security.TestAuthenticationFilter]) 
17:42:40,015 [ApplicationServerThread] DEBUG
server.AbstractTestCaller       - Test result : [Test          failed,
Exception message = [org/apache/cactus/FilterTestCase]] 
17:42:40,015 [ApplicationServerThread] DEBUG
server.AbstractTestCaller       - Result saved in context      scope 

I would be most grateful if anyone could shed any light on this
problem.  It appears to be a problem with my classpath, but I can't
figure out how to fix it.

Thanks in advance,
- Tim

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: NoClassDefFoundError Trying to Test Filter

Posted by Vincent Massol <vm...@octo.com>.
Ok. Hum ... don't know ... 

Are you 100% sure there is no cactus.jar in your system classpath or in
your EAR (specified in META-INF/manifest.mf using Class-Path) ?

Can't think of anything else right now, sorry.

Question: Have you tried using the Cactus sample (as is) with Orion
1.5.x (there is a sample script for Orion 1.5.x) ?

Thanks
-Vincent

> -----Original Message-----
> From: Taylor,Timothy L. [mailto:ttaylor@mitre.org]
> Sent: 01 March 2002 20:37
> To: Cactus Users List
> Subject: Re: NoClassDefFoundError Trying to Test Filter
> 
> I am using the servlet 2.3 version of the cactus jar.  The stack trace
I
> included in my first post actually showed that the FilterRedirector is
> executed.
> 
> C:\projects\Metrics\src\lib>jar tvf cactus.jar | grep Filter
>    749 Wed Feb 27 17:37:10 EST 2002
> org/apache/cactus/client/FilterHttpClient.class
>    909 Wed Feb 27 17:37:10 EST 2002
> org/apache/cactus/FilterTestCase.class
>   2287 Wed Feb 27 17:37:10 EST 2002
> org/apache/cactus/server/FilterConfigWrapper.class
>    990 Wed Feb 27 17:37:10 EST 2002
> org/apache/cactus/server/FilterImplicitObjects.class
>   3696 Wed Feb 27 17:37:10 EST 2002
> org/apache/cactus/server/FilterTestCaller.class
>    779 Wed Feb 27 17:37:10 EST 2002
> org/apache/cactus/server/FilterTestController.class
>   3393 Wed Feb 27 17:37:10 EST 2002
> org/apache/cactus/server/FilterTestRedirector.class
> 
> What's got me so confused is that it can find the
> FilterTestRedirector.class class file, but it can't find the
superclass
> of my test class (FilterTestCase).
> 
> At first, I thought that it might be caused by the fact that the
> AbstractTestCaller class is calling Class.forName() to load the test
> classes since this will not work if the class calling forName was
loaded
> by a ClassLoader higher in the loader chain than the one that can load
> the class passed as the argument to forName().  But both cactus.jar
and
> my test classes are served by the same classloader, so I don't think
> this is the problem.
> 
> I also tried changing the AbstractTestCaller to use the 3 arg version
of
> Class.forName() and passing the Thread Context ClassLoader as the
third
> arg.  This didn't help either, in fact I verified that the ClassLoader
> of the AbstractTestCaller is the same as the thread Context
ClassLoader.
> 
> - Tim Taylor
> 
> Vincent Massol wrote:
> >
> > Hi Timothy,
> >
> > > -----Original Message-----
> > > From: Taylor,Timothy L. [mailto:ttaylor@mitre.org]
> > > Sent: 01 March 2002 19:48
> > > To: cactus-user@jakarta.apache.org
> > > Subject: NoClassDefFoundError Trying to Test Filter
> > >
> > > All,
> > >
> > > I'm trying to use cactus 1.2 to test a filter in the Oracle OC4J
app
> > > server, which is actually Orion (1.5.x, I believe).  I've followed
the
> > > getting started guide correctly, in terms of setting up the server
> > side
> > > classpath, but I've been unable to get this test to work.
> > >
> > > Here's my setup:
> > > - I'm deploying a web application archive (WAR) in an EAR file.
> > > - The WAR file has the following layout:
> > > WEB-INF
> > >   |- web.xml [contains entries for the cactus redirectors]
> > >   |- classes [My classes under test and test classes
> > >   |- lib
> > >      |- cactus.jar
> > >      |- junit.jar
> > >      |- log4j-core.jar
> > >
> >
> > so far so good.
> >
> > > When I run the junit test from my ANT build file, the test report
that
> > > is generated contains the following error:
> > >
> > >   <testcase name="testDoFilter" time="1.202">
> > >     <error message="org/apache/cactus/FilterTestCase"
> > >
> >
type="org.apache.cactus.client.ServletExceptionWrapper">java.lang.NoClas
> > sD
> > > efFoundError:
> > > org/apache/cactus/FilterTestCase
> > >         at java.lang.ClassLoader.defineClass0(Native Method)
> >
> > [snip]
> >
> > hum ... The only reason I can see at this point has to do with the
> > Cactus jar you're using. Are you sure you're using the Cactus for
> > Servlet API 2.3 and not the one for Servlet 2.2 (which does not
contain
> > the FilterTestCase) ?
> >
> > >
> > > The cactus server log file contains the following entries:
[Formatting
> > > altered slightly to improve readability]
> > >
> >
> > [snip]
> >
> > > I would be most grateful if anyone could shed any light on this
> > > problem.  It appears to be a problem with my classpath, but I
can't
> > > figure out how to fix it.
> > >
> > > Thanks in advance,
> > > - Tim
> > >
> >
> > Thanks
> > -Vincent
> >
> > > --
> > > To unsubscribe, e-mail:   <mailto:cactus-user-
> > > unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail: <mailto:cactus-user-
> > > help@jakarta.apache.org>
> > >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: NoClassDefFoundError Trying to Test Filter

Posted by "Taylor,Timothy L." <tt...@mitre.org>.
I am using the servlet 2.3 version of the cactus jar.  The stack trace I
included in my first post actually showed that the FilterRedirector is
executed.

C:\projects\Metrics\src\lib>jar tvf cactus.jar | grep Filter
   749 Wed Feb 27 17:37:10 EST 2002
org/apache/cactus/client/FilterHttpClient.class
   909 Wed Feb 27 17:37:10 EST 2002
org/apache/cactus/FilterTestCase.class
  2287 Wed Feb 27 17:37:10 EST 2002
org/apache/cactus/server/FilterConfigWrapper.class
   990 Wed Feb 27 17:37:10 EST 2002
org/apache/cactus/server/FilterImplicitObjects.class
  3696 Wed Feb 27 17:37:10 EST 2002
org/apache/cactus/server/FilterTestCaller.class
   779 Wed Feb 27 17:37:10 EST 2002
org/apache/cactus/server/FilterTestController.class
  3393 Wed Feb 27 17:37:10 EST 2002
org/apache/cactus/server/FilterTestRedirector.class

What's got me so confused is that it can find the
FilterTestRedirector.class class file, but it can't find the superclass
of my test class (FilterTestCase).

At first, I thought that it might be caused by the fact that the
AbstractTestCaller class is calling Class.forName() to load the test
classes since this will not work if the class calling forName was loaded
by a ClassLoader higher in the loader chain than the one that can load
the class passed as the argument to forName().  But both cactus.jar and
my test classes are served by the same classloader, so I don't think
this is the problem.

I also tried changing the AbstractTestCaller to use the 3 arg version of
Class.forName() and passing the Thread Context ClassLoader as the third
arg.  This didn't help either, in fact I verified that the ClassLoader
of the AbstractTestCaller is the same as the thread Context ClassLoader.

- Tim Taylor

Vincent Massol wrote:
> 
> Hi Timothy,
> 
> > -----Original Message-----
> > From: Taylor,Timothy L. [mailto:ttaylor@mitre.org]
> > Sent: 01 March 2002 19:48
> > To: cactus-user@jakarta.apache.org
> > Subject: NoClassDefFoundError Trying to Test Filter
> >
> > All,
> >
> > I'm trying to use cactus 1.2 to test a filter in the Oracle OC4J app
> > server, which is actually Orion (1.5.x, I believe).  I've followed the
> > getting started guide correctly, in terms of setting up the server
> side
> > classpath, but I've been unable to get this test to work.
> >
> > Here's my setup:
> > - I'm deploying a web application archive (WAR) in an EAR file.
> > - The WAR file has the following layout:
> > WEB-INF
> >   |- web.xml [contains entries for the cactus redirectors]
> >   |- classes [My classes under test and test classes
> >   |- lib
> >      |- cactus.jar
> >      |- junit.jar
> >      |- log4j-core.jar
> >
> 
> so far so good.
> 
> > When I run the junit test from my ANT build file, the test report that
> > is generated contains the following error:
> >
> >   <testcase name="testDoFilter" time="1.202">
> >     <error message="org/apache/cactus/FilterTestCase"
> >
> type="org.apache.cactus.client.ServletExceptionWrapper">java.lang.NoClas
> sD
> > efFoundError:
> > org/apache/cactus/FilterTestCase
> >         at java.lang.ClassLoader.defineClass0(Native Method)
> 
> [snip]
> 
> hum ... The only reason I can see at this point has to do with the
> Cactus jar you're using. Are you sure you're using the Cactus for
> Servlet API 2.3 and not the one for Servlet 2.2 (which does not contain
> the FilterTestCase) ?
> 
> >
> > The cactus server log file contains the following entries: [Formatting
> > altered slightly to improve readability]
> >
> 
> [snip]
> 
> > I would be most grateful if anyone could shed any light on this
> > problem.  It appears to be a problem with my classpath, but I can't
> > figure out how to fix it.
> >
> > Thanks in advance,
> > - Tim
> >
> 
> Thanks
> -Vincent
> 
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> > unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:cactus-user-
> > help@jakarta.apache.org>
> >
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: NoClassDefFoundError Trying to Test Filter

Posted by Vincent Massol <vm...@octo.com>.
Hi Timothy,

> -----Original Message-----
> From: Taylor,Timothy L. [mailto:ttaylor@mitre.org]
> Sent: 01 March 2002 19:48
> To: cactus-user@jakarta.apache.org
> Subject: NoClassDefFoundError Trying to Test Filter
> 
> All,
> 
> I'm trying to use cactus 1.2 to test a filter in the Oracle OC4J app
> server, which is actually Orion (1.5.x, I believe).  I've followed the
> getting started guide correctly, in terms of setting up the server
side
> classpath, but I've been unable to get this test to work.
> 
> Here's my setup:
> - I'm deploying a web application archive (WAR) in an EAR file.
> - The WAR file has the following layout:
> WEB-INF
>   |- web.xml [contains entries for the cactus redirectors]
>   |- classes [My classes under test and test classes
>   |- lib
>      |- cactus.jar
>      |- junit.jar
>      |- log4j-core.jar
> 

so far so good.

> When I run the junit test from my ANT build file, the test report that
> is generated contains the following error:
> 
>   <testcase name="testDoFilter" time="1.202">
>     <error message="org/apache/cactus/FilterTestCase"
>
type="org.apache.cactus.client.ServletExceptionWrapper">java.lang.NoClas
sD
> efFoundError:
> org/apache/cactus/FilterTestCase
>         at java.lang.ClassLoader.defineClass0(Native Method)

[snip]

hum ... The only reason I can see at this point has to do with the
Cactus jar you're using. Are you sure you're using the Cactus for
Servlet API 2.3 and not the one for Servlet 2.2 (which does not contain
the FilterTestCase) ?

> 
> The cactus server log file contains the following entries: [Formatting
> altered slightly to improve readability]
> 

[snip]

> I would be most grateful if anyone could shed any light on this
> problem.  It appears to be a problem with my classpath, but I can't
> figure out how to fix it.
> 
> Thanks in advance,
> - Tim
> 

Thanks
-Vincent

> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>