Problem using remote interface
jgbargar Sep 25, 2004 10:47 PMHello there,
Our application (in a bold new use of J2EE technology ;)) has Session EJBs that are called remotely. I am having a problem where I am able to successfully lookup the Home but then the create() method is failing. I have confirmed that the Session bean in question is deploying successfully by watching the console at deploy time as well as looking at the jmx-console. Additionally, the lookup listen port is correct as confirmed by a telnet. Any insight on this would be greatly appreciated as I am stuck on something that I feel should be routine, and am unable to move forward on the project I am working on.
------------------------
calling code:
------------------------
public void testLookup() throws Throwable {
String method = "testLookup";
assertTrue(getHome() != null);
WebManagerRemote wmr = getHome().create();
log(getHome().toString());
}
------------------------
helper method code:
------------------------
WebManagerRemoteHome getHome() throws Throwable {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.PROVIDER_URL, "127.0.0.1:1099");
String jndiName = "com.pixelfixx.service.WebManager";
// Obtain initial context
javax.naming.InitialContext initialContext = new javax.naming.InitialContext(env);
Class narrowTo = com.pixelfixx.service.WebManagerRemoteHome.class;
Object objRef;
try {
objRef = initialContext.lookup(jndiName);
// only narrow if necessary
if (narrowTo.isInstance(java.rmi.Remote.class))
objRef = javax.rmi.PortableRemoteObject.narrow(objRef, narrowTo);
} finally {
initialContext.close();
}
return (com.pixelfixx.service.WebManagerRemoteHome) objRef;
}
------------------------
error
------------------------
[junit] java.lang.IndexOutOfBoundsException: Index: 14, Size: 14
[junit] at java.util.ArrayList.RangeCheck(ArrayList.java:507)
[junit] at java.util.ArrayList.get(ArrayList.java:324)
[junit] at org.jboss.invocation.InvocationKey.readResolve(InvocationKey.java:118)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:925)
[junit] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1655)
[junit] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
[junit] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
[junit] at java.util.HashMap.readObject(HashMap.java:1005)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
[junit] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
[junit] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
[junit] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
[junit] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
[junit] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
[junit] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
[junit] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
[junit] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
[junit] at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:109)
[junit] at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1686)
[junit] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1644)
[junit] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
[junit] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
[junit] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
[junit] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
[junit] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
[junit] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
[junit] at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
[junit] at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:139)
[junit] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:92)
[junit] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
[junit] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
[junit] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:175)
[junit] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:82)
[junit] at $Proxy0.create(Unknown Source)
[junit] at com.pixelfixx.service.WebManagerTest.testLookup(WebManagerTest.java:113)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit]
[junit] Testcase: testLookup