[jboss-user] [JNDI/Naming/Network] - ClassCastException in remote EJB3.0 lookup from tomcat webap

skymic do-not-reply at jboss.com
Mon Feb 19 09:41:13 EST 2007


Hi everyone,

I am trying to connect to an EJB3.0 remote session bean (deployed in an ear on JBoss V4.0.5) from a tomcat V5.5 webapp. The tomcat and the JBoss installation are deployed on different machines.

I get the following ClassCastException in a call to PortableRemoteObject.narrow:

java.lang.ClassCastException
	at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)

Caused by: java.lang.ClassCastException: javax.naming.Reference
	at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)

Here is my client code:

            String urlName = "jnp://156.135.155.156: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("SDOCIBusinessApp/SDOCIBusinessServiceImpl/remote");

            SDOCIBusinessService narrowed = (SDOCIBusinessService )PortableRemoteObject.narrow(ref, SDOCIBusinessService.class);

Here is the list output of jmx-console:

Global JNDI Namespace
  +- HASessionState (class: org.jnp.interfaces.NamingContext)
  |   +- Default (class: org.jboss.ha.hasessionstate.server.HASessionStateImpl)
  +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
  +- jmx (class: org.jnp.interfaces.NamingContext)
  |   +- invoker (class: org.jnp.interfaces.NamingContext)
  |   |   +- RMIAdaptor (proxy: $Proxy52 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
  |   +- rmi (class: org.jnp.interfaces.NamingContext)
  |   |   +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
  +- SDOCIBusinessApp (class: org.jnp.interfaces.NamingContext)
  |   +- SDOCIBusinessServiceImpl (class: org.jnp.interfaces.NamingContext)
  |   |   +- remote (class: java.lang.Object)
  |   |   +- remoteStatefulProxyFactory (proxy: $Proxy87 implements interface org.jboss.ejb3.ProxyFactory)
  |   +- ExcelConverterImpl (class: org.jnp.interfaces.NamingContext)
  |   |   +- local (proxy: $Proxy79 implements No ClassLoaders found for: ch.skyguide.aim.interfaces.businesslogic.converter.ExcelConverter (no security manager: RMI class loader disabled))
  |   +- IBriefingExportInvokerImpl (class: org.jnp.interfaces.NamingContext)
  |   |   +- local (proxy: $Proxy82 implements No ClassLoaders found for: ch.skyguide.aim.interfaces.businesslogic.exportinvoker.IBriefingExportInvoker (no security manager: RMI class loader disabled))

I have packaged the EJB plus interfaces in an SDOCIBusinessApp.ear to be deployed on jboss and also as a jar in the WEB-INF/lib directory in the war file of my webapp since the webapp needs to reference the interface SDOCIBusinessService.

I have read all sorts of posted topics which seem to deal with this ClassCastException but I haven't found the solution to my problem yet.

Can anybody help?



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

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



More information about the jboss-user mailing list