I have a very simple Stateless session bean with a single method that returns an
Enumeration (created from a Vector) of Serializable objects, yet I am getting a
marshalling error.
I'm new to this and suspect it is something very simple - help would be much
appreciated.
The remote interface is as follows:
---
import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.Enumeration;
import java.util.Properties;
public interface Test extends EJBObject
{
public Enumeration getResults(Properties criteria)
throws RemoteException;
}
----
The implementation of the remote method is as follows:
----
public Enumeration getResults(Properties criteria)
{
// HARD-CODED STUB
Vector v = new Vector();
v.addElement( new TestDetails(
new Integer(1), "A","Low Cost Term",
new Float(10.00) ) );
v.addElement( new TestDetails(
new Integer(2), "A","Portable Term",
new Float(15.00) ) );
v.addElement( new TestDetails(
new Integer(3), "B","Low Start Term",
new Float(20.00) ) );
v.addElement( new TestDetails(
new Integer(4), "C","Low Start Term",
new Float(25.00) ) );
return v.elements();
}
----
TestDetails is an 'attribute' class that implements Serializable.
I have a test client with code as follows:
----
// get context
System.out.println("Obtaining initial context ...");
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
InitialContext ctx = new InitialContext(p);
System.out.println("... SUCCESS.");
// locate object
System.out.println("Locating Home ...");
TestHome home = (TestHome) ctx.lookup("TestHome");
System.out.println("... SUCCESS.");
// create an object
System.out.println("Creating bean ...");
Test bean = home.create();
System.out.println("... SUCCESS.");
// run method
System.out.println("Running method ...");
Enumeration results = bean.getResults(new Properties());
System.out.println("... SUCCESS.");
// clear up
bean.remove();
ctx.close();
----
The test fails at the bean.getResults() method with the following error
----
java.rmi.RemoteException: ; nested exception is:
weblogic.rmi.ServerException: A remote exception occurred while executing the
method on the remote object
- with nested exception:
[weblogic.rmi.MarshalException: error marshalling return
- with nested exception:
[java.io.IOException: Class java.util.Vector$1 with code=123 does not implement
Serializable, Externalizable or WLSerializable]]
java.io.IOException: Class java.util.Vector$1 with code=123 does not implement
Serializable, Externalizable or WLSerializable
at
weblogic.common.internal.WLObjectOutputStreamBase.writeObjectBody(WLObjectOutputStreamBase.java:895)
at
weblogic.common.internal.WLObjectOutputStreamBase.writeObject(WLObjectOutputStreamBase.java,
Compiled Code)
at
weblogic.common.internal.WLObjectOutputStreamBase.writeObjectWL(WLObjectOutputStreamBase.java,
Compiled Code)
at
weblogic.rmi.extensions.AbstractOutputStream2.writeObject(AbstractOutputStream2.java:82)
at TestBeanEOImpl_WLSkel.invoke(TestBeanEOImpl_WLSkel.java:137)
at
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java,
Compiled Code)
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java:69)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
--------------- nested within: ------------------
weblogic.rmi.MarshalException: error marshalling return
- with nested exception:
[java.io.IOException: Class java.util.Vector$1 with code=123 does not implement
Serializable, Externalizable or WLSerializable]
at TestBeanEOImpl_WLSkel.invoke(TestBeanEOImpl_WLSkel.java:139)
at
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java,
Compiled Code)
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java:69)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
--------------- nested within: ------------------
weblogic.rmi.ServerException: A remote exception occurred while executing the method
on the remote object
- with nested exception:
[weblogic.rmi.MarshalException: error marshalling return
- with nested exception:
[java.io.IOException: Class java.util.Vector$1 with code=123 does not implement
Serializable, Externalizable or WLSerializable]]
at weblogic.rmi.extensions.AbstractRequest.sendReceive(Compiled Code)
at TestBeanEOImpl_WLStub.getResults(TestBeanEOImpl_WLStub.java:368)
at TestBeanEOImpl_ServiceStub.getResults(TestBeanEOImpl_ServiceStub.java:253)
at Client.runTest(Client.java:49)
at Client.main(Client.java:81)
Exception in thread "main"
----
the environment is WindowsNT4.0, WLS5.1 and Java2.
I'm sure it is something simple and therefore any help would be extremely appreciated.
regards
Ed
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".