Issue looking up session bean in UDP
joydeep.sarkar Jun 25, 2010 2:00 AMDear All,
I am trying to look up a session bean which is configured in UDP cluster in JBoss5.1.0GA.
I am using EJB 3 and JDK 5.
Following is the client code,
import test.session.HelloSession;
import test.session.HelloSessionBean;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
public class TestMasterSlave {
public static void main(String[] args) {
Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url","224.0.0.2:9876");
Context context;
try{
context = new InitialContext(properties);
System.out.println(context.getEnvironment());
HelloSession helloSession = (HelloSession) context.lookup("remote/HelloSession");
helloSession.sayHello();
} catch (NamingException e){
e.printStackTrace();
}
}
}
I have used multicast address as provider url and the client is also inside the UDP network. Now when I run the client I get the following error,
Exception in thread "main" java.lang.IllegalStateException: Failed to find method for hash:-790108502850547550 available={-884175917852741154=public abstract java.lang.Object org.jnp.interfaces.Naming.lookup(javax.naming.Name) throws javax.naming.NamingException,java.rmi.RemoteException, -5642140585403320990=public abstract java.util.Collection org.jnp.interfaces.Naming.listBindings(javax.naming.Name) throws javax.naming.NamingException,java.rmi.RemoteException, -4221607359560216057=public abstract java.util.Collection org.jnp.interfaces.Naming.list(javax.naming.Name) throws javax.naming.NamingException,java.rmi.RemoteException, -5717908715153450081=public abstract void org.jnp.interfaces.Naming.rebind(javax.naming.Name,java.lang.Object,java.lang.String) throws javax.naming.NamingException,java.rmi.RemoteException, -8107796390111393345=public abstract void org.jnp.interfaces.Naming.unbind(javax.naming.Name) throws javax.naming.NamingException,java.rmi.RemoteException, -7286638714004764603=public abstract javax.naming.Context org.jnp.interfaces.Naming.createSubcontext(javax.naming.Name) throws javax.naming.NamingException,java.rmi.RemoteException, -6149798079139202860=public abstract void org.jnp.interfaces.Naming.bind(javax.naming.Name,java.lang.Object,java.lang.String) throws
javax.naming.NamingException,java.rmi.RemoteException}
at org.jboss.invocation.MarshalledInvocation.getMethod(MarshalledInvocation.java:407)
at org.jboss.ha.framework.server.HARMIServerImpl.invoke(HARMIServerImpl.java:198)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:127)
at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:196)
at $Proxy0.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at client.TestMasterSlave.main(TestMasterSlave.java:25)
I am not sure what exactly is causing the issue. Is the UDP lookup as same as JNDI from a client code?
Could anyonep please help me on the same?