[jboss-user] [JNDI/Naming/Network] - Re: invoking remote session bean NotContextException
srki
do-not-reply at jboss.com
Fri Nov 3 13:33:49 EST 2006
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();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.security.jndi.JndiLoginInitialContextFactory");
props.setProperty(Context.SECURITY_PRINCIPAL, "admin");
props.setProperty(Context.SECURITY_CREDENTIALS, "admin");
props.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
String host = "jnp://localhost:1099";
props.setProperty(Context.PROVIDER_URL, host);
ctx = new InitialContext( props );
Object object = ctx.lookup( "ejb/com/blah/Manager" );
ManagerRemoteHome home = (ManagerRemoteHome)PortableRemoteObject.narrow ( object, ManagerRemoteHome.class);
ManagerRemote manager = home.create();
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983059#3983059
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983059
More information about the jboss-user
mailing list