I still didn't solve my problem but I tried to deploy it on my local machine and see I could somehow find what the issue is when deploying it on a remote machine.
Initially deploying it on my local machine everything worked fine
However when I add the following line I see that code breaks.
String host = "jnp://localhost:1099"; props.setProperty(Context.PROVIDER_URL, host); I started getting the following exception 2006-11-03 10:17:18,319 ERROR [STDERR] java.lang.ClassCastException 2006-11-03 10:17:18,319 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229) 2006-11-03 10:17:18,319 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
As soon as I uncomment that props.setProperty(Context.PROVIDER_URL, host);
line everything works fine.
I have seen this type of exception before when I tried invoking the ejb on a different computer as well. I am not sure how to see what is the wrapper class for the object since the call to object.getClass().getName() prints something like this $Proxy184
This is my code again:
Properties props = new Properties();
String host = "jnp://localhost:1099";
ctx = new InitialContext( props );
Object object = ctx.lookup( "ejb/com/blah/Manager" );
ManagerRemoteHome home = (ManagerRemoteHome)PortableRemoteObject.narrow ( object, ManagerRemoteHome.class);
ManagerRemote manager = home.create();
Through reflection on object I see that it is the correct HomeRemote interface and the right method, but I still can not figure out what is the difference of specifying Context.PROVIDER_URL with jnp://localhost:1099