Hi Sergio,
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 22, 2001 2:35 PM
Subject: running cactus example on j2ee reference server [Virus checked]
> Hi,
>
> I'm trying to get the EJB cactus example to run. I always get a
> java.io.StreamCorruptedException. Has somebody else ever had a running
> example for the j2ee reference server? If somebody has an ear file with
the
> EJB and the web- container I would be interessted in it.
> I build an ear file for the j2ee-ri server but never succeeded to get it
> run.
>
> When I type in the cactus.servletRedirectorURL defined in the
> cactus.properties in a browser I always get the following error.
> What does it mean currently unabailable?
>
That means that the URL you type ( it should be "http://<server
name>:<port>/exampletest2/ServletRedirector/" according to your settings) is
found but the servlet is failing for some reason. BTW, I couldn't find the
cactus.properties file, have you put it on the system classpath ?
Normally if you get a 503 error, you should see a stack trace in the
server's console. Could you cut and paste that trace ?
thanks
-Vincent
> regards
> Sergio D'Oronzio
>
> ----------------------------- error when key in the servletRedirectorUrl
in
> a browser.--------------------------------------------------
>
>
> HTTP Status 503 - Servlet ServletRedirector is currently unavailable
> The requested service (Servlet ServletRedirector is currently unavailable)
> is not currently available.
>
>
> ------------------------------- error when running the test within ant
> --------------------------------------------------------------------------
> run_tests:
> [junit] Running org.apache.cactus.sample.ejb.ConverterTest
> [junit] Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 1.452 sec
> [junit] Testsuite: org.apache.cactus.sample.ejb.ConverterTest
> [junit] Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 1.452 sec
> [junit]
> [junit] Testcase: testDummy took 1.272 sec
> [junit] Caused an ERROR
> [junit] InputStream does not contain a serialized object
> [junit] java.io.StreamCorruptedException: InputStream does not contain
> a serialized object
> [junit] at
> java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
> [junit] at
> java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
> [junit] at
>
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:1
48)
> [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]
> [junit] Testcase: testConvert took 0.17 sec
> [junit] Caused an ERROR
> [junit] InputStream does not contain a serialized object
> [junit] java.io.StreamCorruptedException: InputStream does not contain
> a serialized object
> [junit] at
> java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:849)
> [junit] at
> java.io.ObjectInputStream.<init>(ObjectInputStream.java:168)
> [junit] at
>
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:1
48)
> [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]
> [junit] TEST org.apache.cactus.sample.ejb.ConverterTest FAILED
>
> src file in org.apache.cactus.sample.ejb:
>
> package org.apache.cactus.sample.ejb;
>
> import java.rmi.*;
> import javax.ejb.*;
>
> public interface Converter extends EJBObject
> {
> public double convertYenToDollar(double theYenAmount) throws
> RemoteException;
> }
>
> --------------------------------------------------------------------------
----------------------------------------------------
>
> package org.apache.cactus.sample.ejb;
>
> import javax.ejb.*;
>
> public class ConverterEJB implements SessionBean
> {
> private SessionContext context;
>
> public double convertYenToDollar(double theYenAmount)
> {
> return theYenAmount / 100.0;
> }
>
> public ConverterEJB()
> {
> }
>
> public void ejbCreate() throws CreateException
> {
> }
>
> public void setSessionContext(SessionContext theContext)
> {
> this.context = theContext;
> }
>
> public void ejbActivate()
> {
> }
>
> public void ejbPassivate()
> {
> }
>
> public void ejbRemove()
> {
> }
> }
> --------------------------------------------------------------------------
----------------------------------------------------
>
> package org.apache.cactus.sample.ejb;
>
> import java.rmi.*;
> import javax.ejb.*;
>
> public interface ConverterHome extends EJBHome
> {
> public Converter create() throws RemoteException, CreateException;
> }
>
> --------------------------------------------------------------------------
----------------------------------------------------
> package org.apache.cactus.sample.ejb;
>
> import javax.naming.*;
> import javax.rmi.*;
> import junit.framework.*;
>
> import org.apache.cactus.*;
>
> public class ConverterTest extends ServletTestCase
> {
> private Converter converter;
>
> public ConverterTest(String name)
> {
> super(name);
> }
>
> public static Test suite()
> {
> return new TestSuite(ConverterTest.class);
> }
>
> public void setUp()
> {
> try
> {
> Context ctx = new InitialContext();
> ConverterHome home
> = (ConverterHome)PortableRemoteObject.narrow(ctx.lookup
> ("java:comp/ejb/Converter"), ConverterHome.class);
> this.converter = home.create();
> } catch (Exception e)
> {
> System.out.println("Exception during creation of ejb :"+e);
> e.printStackTrace();
> }
> }
>
> public void testDummy() throws Exception
> {
> assertTrue(true);
> }
>
> public void testConvert() throws Exception
> {
> double dollar = this.converter.convertYenToDollar(100.0);
> assertEquals("dollar", 1.0, dollar, 0.01);
> }
> }
> --------------------------------------------------------------------------
----------------------------------------------------
>
> ear file for the j2ee reference server is attached(See attached file:
> cactus_ejb-example.ear)
>