jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@pivolis.com>
Subject RE: Testing EJBs
Date Fri, 29 Aug 2003 15:47:15 GMT
Hi,

> -----Original Message-----
> From: qqasim@csd.abdn.ac.uk [mailto:qqasim@csd.abdn.ac.uk]
> Sent: 26 August 2003 11:27
> To: Cactus Users List
> Subject: Testing EJBs
> 
> I am tryin to test a simple session bean. This bean has a simple
method:
> 
>  public String printName(String n){
> 	String name=n;
> 	System.out.println("name is "+ name);
> 	return name;
> 	}
> 
> I followed the EJB example provided in the cactus/samples to write a
test
> class
> for this bean and included the following method to test my
printName(..)
> method:
> 
> public void testPrintName() throws Exception
>     {
>     	try
>     	{
>     	String s = cFacade.printName("john");
>         assertNotNull(s);
>     	}
>     	catch(Exception e)
>     	{
>     		e.printStackTrace();
>     	}
>     }

BTW, this is bad practice. You should not use the try/catch. Any error
will be reported to the JUnit test runner.

> 
> But when I run my test class using the browser, I get the following
> errors:
> 
> Name: testPrintName
> Status: Error
> "
> org.apache.commons.httpclient.HttpMethod.setRequestHeader
> (Ljava/lang/String;Ljava/lang/String;)V
> 
> java.lang.NoSuchMethodError:
> org.apache.commons.httpclient.HttpMethod.setRequestHeader
> (Ljava/lang/String;Ljava/lang/String;)V
> at
>
org.apache.cactus.client.connector.http.HttpClientConnectionHelper.dispa
tc
> h50_co
>
nnect(HttpClientConnectionHelper.java;org/apache/cactus/util/log/LogAspe
ct
> .aj
> [1k]:152)
> at  ....".
> 
> Can anyone guide me how to solve this problem or any other information
on
> testing ejb.
> 

I think that's because you're not using the correct version of
commons-httpclient. Are you using JBoss? It has an old version that you
need to replace.

-Vincent



Mime
View raw message