Hi,

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> 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



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to