jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ken adjei <kencac...@yahoo.com>
Subject problems testing ejb's using cactus in OC4J (originally orion server
Date Thu, 26 Sep 2002 09:35:20 GMT

Hi all I have downloaded the latest version of cactus to use it for testing ejb's in 

(OC4J) version 1.0.2.2.1

.

I have gone through the documentation and wrote my test class which extends the ServletTestCase
to the ejb 

here is the code :

public class SampleConverterEJBClient extends ServletTestCase
{
  private ConverterEJB converterEJB;

    public SampleConverterEJBClient(String name)
    {
            super(name);
        }

    public static void main(String []args){
      junit.textui.TestRunner.run(suite());
      
    }
    public static Test suite()
    {
      return new TestSuite(SampleConverterEJBClient.class);
    }

    public void setUp()
    {
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY,     "com.evermind.server.rmi.RMIInitialContextFactory");
      env.put(Context.SECURITY_PRINCIPAL, "admin");
      env.put(Context.SECURITY_CREDENTIALS, "welcome");
      env.put(Context.PROVIDER_URL, "ormi://localhost:23891/current-workspace-app");
Context ctx = new InitialContext(env);
ConverterEJBHome converterEJBHome = (ConverterEJBHome) PortableRemoteObject.narrow(ctx.lookup("ConverterEJB"),ConverterEJBHome.class);
 this.converterEJB = converterEJBHome.create(); 


    } catch(Throwable ex){
      ex.printStackTrace();
    }
    }

    public void testConvert() throws Exception
    {
      try{
        double dollar = this.converterEJB.convertYenToDollar(100.0);
        assertEquals("dollar", 1.0, dollar, 0.01);
     } catch(Throwable ex){
      ex.printStackTrace();
    }
    }

}

 

However, for what ever reason it seems that the setup is not being called as it would do in
junit  and the exeception I'm getting is :

 

E

Time: 1.232

There was 1 error:

1) testConvert(test.SampleConverterEJBClient)

java.net.ConnectException: Connection refused: connect

 void java.net.PlainSocketImpl.socketConnect(java.net.InetAddress, int)

 void java.net.PlainSocketImpl.doConnect(java.net.InetAddress, int)

 void java.net.PlainSocketImpl.connectToAddress(java.net.InetAddress, int)

 void java.net.PlainSocketImpl.connect(java.net.InetAddress, int)

 void java.net.Socket.<init>(java.net.InetAddress, int, java.net.InetAddress, int, boolean)

 void java.net.Socket.<init>(java.lang.String, int)

 void org.apache.commons.httpclient.HttpConnection.open()

 int org.apache.commons.httpclient.HttpClient.executeMethod(org.apache.commons.httpclient.HttpMethod)

 java.net.HttpURLConnection org.apache.cactus.client.HttpClientConnectionHelper.dispatch24_connect(org.apache.cactus.WebRequest)

 java.lang.Object org.apache.cactus.client.HttpClientConnectionHelper.around24_connect(org.aspectj.runtime.internal.AroundClosure,
org.aspectj.lang.JoinPoint, org.apache.cactus.util.log.LogAspect, org.apache.cactus.WebRequest)

 java.net.HttpURLConnection org.apache.cactus.client.HttpClientConnectionHelper.connect(org.apache.cactus.WebRequest)

 java.net.HttpURLConnection org.apache.cactus.client.AbstractHttpClient.callRunTest(org.apache.cactus.WebRequest)

 java.net.HttpURLConnection org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(org.apache.cactus.WebRequest)

 java.lang.Object org.apache.cactus.client.AbstractHttpClient.around2_doTest(org.aspectj.runtime.internal.AroundClosure,
org.aspectj.lang.JoinPoint, org.apache.cactus.util.log.LogAspect, org.apache.cactus.WebRequest)

 java.net.HttpURLConnection org.apache.cactus.client.AbstractHttpClient.doTest(org.apache.cactus.WebRequest)

 void org.apache.cactus.AbstractWebTestCase.runGenericTest(org.apache.cactus.client.AbstractHttpClient)

 void org.apache.cactus.ServletTestCase.runTest()

 void org.apache.cactus.AbstractTestCase.runBare()

 void test.SampleConverterEJBClient.main(java.lang.String[])

 

FAILURES!!!

Tests run: 1,  Failures: 0,  Errors: 1


 

Can any one help

 

PLEASE let know what I doing wrong or how your meant to call this test class to run in from
a browser as it has been done in the example application.

(reason being I can get the example to run in tomcat using a servlet but can not do so using
an ejb in OC4J)

 

cheers 

 



---------------------------------
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message