[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - Re: EJB lookup on standalone tomcat to remote jboss

skymic do-not-reply at jboss.com
Mon Feb 12 09:00:56 EST 2007


Yes, I am trying to connect to a remote session bean through a web service endpoint.
But I am not calling the javax.xml.soap.MessageFactory explicitly. This is done in the code which was generated from jaxws2.0 (wsdl to java).

However I am a bit further now. I threw out the jbossall-client.jar and replaced it with jnp-client.jar and jboss-common-client.jar. Now the webservice can lookup the remote EJB but fails in the final PortableObject.narrow call. 

Here's my lookup code:
            String urlName = "jnp://localhost:1099";
            Properties p = new Properties();
            p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
            p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
            p.put(Context.PROVIDER_URL, urlName);
            p.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");

            InitialContext ic = new InitialContext(p);

            Object ref = ic.lookup("SDOCI/remote/SDOCIBusinessService");
            
            SDOCIBusinessService busiService = (SDOCIBusinessService) PortableRemoteObject.narrow(ref, SDOCIBusinessService.class);

Here is the exception:
java.lang.ClassCastException
	at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
	at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
	at ch.skyguide.aim.interfaces.ws.server.SDOCustomerInterfacesImpl.login(SDOCustomerInterfacesImpl.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.sun.xml.ws.server.PeptTie._invoke(PeptTie.java:58)
	at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.invokeEndpoint(SOAPMessageDispatcher.java:254)
	at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(SOAPMessageDispatcher.java:547)
	at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:140)
	at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
	at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.handle(WSServletDelegate.java:279)
	at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:232)
	at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:77)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: javax.naming.Reference
	at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)

Does anyone know what I must do to lookup an remote EJB3.0 from a tomcat webapp?

Any help is appreciated.




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

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



More information about the jboss-user mailing list