Hi all.
I have 2 servers running under the same JBoss 4.0.5 on my PC. The second server is configured to use different ports.
From one server I am connecting to the JNDI tree of the other server to lookup an EJB:
Properties h = System.getProperties();
h.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
h.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
h.setProperty(Context.PROVIDER_URL, http://localhost:9000/invoker/JNDIFactory);
Context ctx = new InitialContext(h);
Object objref = ctx.lookup("ejb/mif/ListeAllegateFacade");
ListeAllegateFacadeHome home = (ListeAllegateFacadeHome)PortableRemoteObject.narrow(objref, ListeAllegateFacadeHome.class);
As you see I am using http to connect to the JNDI tree.
During the narrowing, on the last line, I get a ClassCastException.
Using the jnp protocol with the same code everthing works fine:
Properties h = System.getProperties();
h.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
h.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
h.setProperty(Context.PROVIDER_URL, jnp://localhost:5022);
Context ctx = new InitialContext(h);
Object objref = ctx.lookup("ejb/mif/ListeAllegateFacade");
EJBHome home = (ListeAllegateFacadeHome)PortableRemoteObject.narrow(objref, ListeAllegateFacadeHome.class);
No ClassCastException thrown.
It seems a configuration problem, but I have no idea where to look at.
Can you please give me some advices?
Any help will be highly appreciated.
Best regards,
Felix Sima