test EJB with junit:can not create the remote interface!
xbird Mar 21, 2003 4:10 AMI use the "jboss-3.0.3_tomcat-4.1.12".All works well.
But now ,i need to do the unit test(use Jnuit) for my session bean.Thus i need to get my ejb's remote interface outside the container.
The problem is : i can get the home interface correctly,but when i try to use this home to create the remote interface,exception thrown out:
1) testGetRemoteInterface(com.ncs.test.iwa.timelog.TestReportBean)java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.net.SocketException: Connection aborted by peer: JVM_recv in socket input stream read
java.net.SocketException: Connection aborted by peer: JVM_recv in socket input stream read
at java.net.SocketInputStream.socketRead(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:86)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:186)
at java.io.BufferedInputStream.read(BufferedInputStream.java:204)
at java.io.DataInputStream.readByte(DataInputStream.java:222)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:186)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:128)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
at $Proxy0.create(Unknown Source)
my code is
========================================================
Hashtable property = new Hashtable();
property.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
property.put("java.naming.provider.url", "localhost:1099");
property.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
property.put("jnp.socketFactory", "org.jnp.interfaces.TimedSocketFactory");
InitialContext jndiContext = new InitialContext(property);
Object ref = jndiContext.lookup(jndiName);
ReportHome reportHome=(reportHome)PortableRemoteObject.narrow(ref, reportHome.class);
reportHome.create();
=========================================================
the reportHome can get ok.
but once i invoke the reportHome.create(),exception.
any hint?
would u like to reply to tec_caowei@hotmail.com if u have solution,so appreciated!