[jboss-user] [JNDI/Naming/Network] - Re: Proxy ClassCastException after successful EJB lookup

skymic do-not-reply at jboss.com
Fri Feb 16 08:29:41 EST 2007


Hi cupdike and Peter,

I think I have the same problem with classloaders.
I am using a standalone tomcat V5.5 and try to lookup a remote EJB in a JBoss4.0.5 (on a different machine) using this code in my servlet:

            String urlName = "jnp://localhost:1099";
            Properties p = new Properties();
            p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
            p.put(Context.PROVIDER_URL, urlName);
            p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
            InitialContext ic = new InitialContext(p);
            Object ref = ic.lookup("SDOCI/remote/SDOCIBusinessService");
            SDOCIBusinessService busiService =  (SDOCIBusinessService )PortableRemoteObject.narrow(ref, SDOCIBusinessService.class);

I get the following exception:
java.lang.ClassCastException
	at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
Caused by: java.lang.ClassCastException: javax.naming.Reference

Yes I have deployed my remote EJB in an ear on JBoss and also included the interface of my remote bean in a jar in WEB-INF/lib since my webapp must know the interface I am trying to narrow.

Anyway I get this exception. 
Does anyone of you have an idea?

Thanks for your help.





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017606#4017606

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017606



More information about the jboss-user mailing list