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 "Alderman, Rachel" <rg...@netperceptions.com> on 2002/03/20 19:50:39 UTC

NoClassDefFoundError httpclient

I'm trying to get my testcases that use cactus to run on tomcat 4.0 using
ant.  I create a warfile for my test classes.  In its WEB-INF/lib directory,
I include the cactus, junit and httpclient jars.

This is my tests target in my build file:
  <target name="tests">
    <junit printsummary="yes" haltonfailure="yes" fork="yes">
      <classpath>
        <pathelement location="${third.party.dir}/lib/servlet.jar"/>
        <pathelement location="${third.party.dir}/lib/cactus.jar"/>
        <pathelement location="${third.party.dir}/lib/junit.jar}"/>
        <pathelement location="${third.party.dir}/lib/httpclient.jar}"/>
        <pathelement location="${build.classes.test}"/>
        <pathelement path="${java.class.path}"/>
      </classpath>
      <formatter type="plain" usefile="false"/>
      <test
name="com.netperceptions.gui.account.test.AccountControllerTest"/>
    </junit>
  </target>

This is my error when building:
    [junit] org/apache/commons/httpclient/NameValuePair
    [junit] java.lang.NoClassDefFoundError:
org/apache/commons/httpclient/NameValuePair
    [junit]     at
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:1
23)
    [junit]     at
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:422)
    [junit]     at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
    [junit]     at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
    [junit]     at junit.framework.TestResult$1.protect(TestResult.java:106)
    [junit]     at
junit.framework.TestResult.runProtected(TestResult.java:124)
    [junit]     at junit.framework.TestResult.run(TestResult.java:109)
    [junit]     at junit.framework.TestCase.run(TestCase.java:131)
    [junit]     at junit.framework.TestSuite.runTest(TestSuite.java:173)
    [junit]     at junit.framework.TestSuite.run(TestSuite.java:168)
    [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:231)
    [junit]     at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:409)
    [junit]

Any advice would be appreciated.  
Thanks.
Rachel

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


RE: NoClassDefFoundError httpclient

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

I see 2 options :

1/ The path "${third.party.dir}/lib/httpclient.jar}" is invalid. BTW,
the official jar name for HttpClient is commons-httpclient.jar, this is
maybe your error ?

or

2/ You're using an old version of HttpClient which did not have the
NameValuePair class

If you can, use the httpclient jar that is provided in the Cactus
distribution as it has been tested and is certified to work.

Hope this helps,
-Vincent

> -----Original Message-----
> From: Alderman, Rachel [mailto:rgronholz@netperceptions.com]
> Sent: 20 March 2002 18:51
> To: 'Cactus Users List'
> Subject: NoClassDefFoundError httpclient
> 
> I'm trying to get my testcases that use cactus to run on tomcat 4.0
using
> ant.  I create a warfile for my test classes.  In its WEB-INF/lib
> directory,
> I include the cactus, junit and httpclient jars.
> 
> This is my tests target in my build file:
>   <target name="tests">
>     <junit printsummary="yes" haltonfailure="yes" fork="yes">
>       <classpath>
>         <pathelement location="${third.party.dir}/lib/servlet.jar"/>
>         <pathelement location="${third.party.dir}/lib/cactus.jar"/>
>         <pathelement location="${third.party.dir}/lib/junit.jar}"/>
>         <pathelement
location="${third.party.dir}/lib/httpclient.jar}"/>
>         <pathelement location="${build.classes.test}"/>
>         <pathelement path="${java.class.path}"/>
>       </classpath>
>       <formatter type="plain" usefile="false"/>
>       <test
> name="com.netperceptions.gui.account.test.AccountControllerTest"/>
>     </junit>
>   </target>
> 
> This is my error when building:
>     [junit] org/apache/commons/httpclient/NameValuePair
>     [junit] java.lang.NoClassDefFoundError:
> org/apache/commons/httpclient/NameValuePair
>     [junit]     at
>
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.ja
va
> :1
> 23)
>     [junit]     at
>
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:
42
> 2)
>     [junit]     at
> org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
>     [junit]     at
> org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
>     [junit]     at
> junit.framework.TestResult$1.protect(TestResult.java:106)
>     [junit]     at
> junit.framework.TestResult.runProtected(TestResult.java:124)
>     [junit]     at junit.framework.TestResult.run(TestResult.java:109)
>     [junit]     at junit.framework.TestCase.run(TestCase.java:131)
>     [junit]     at
junit.framework.TestSuite.runTest(TestSuite.java:173)
>     [junit]     at junit.framework.TestSuite.run(TestSuite.java:168)
>     [junit]     at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe
st
> Ru
> nner.java:231)
>     [junit]     at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT
es
> tR
> unner.java:409)
>     [junit]
> 
> Any advice would be appreciated.
> Thanks.
> Rachel
> 
> --
> 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>