aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Calling glassfish EJB from tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Calling glassfish EJB from tomcat" Watch "Calling glassfish EJB from tomcat" New topic
Author

Calling glassfish EJB from tomcat

Nasir Mkhan
Greenhorn

Joined: May 13, 2001
Posts: 28
Hi,

I am trying to call remote EJB on glassfish from tomcat 5.5. I am using JDK 1.6. I copied following glassfish jar files to tomcat/shared/lib directory
1 - appserv-rt.jar
2 - appserv-deployment-client.jar
3 - appserv-ext.jar
4 - javaee.jar


Using following cod to call EJB

Properties props = new Properties();
props.put("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
props.put("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
props.put("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.setProperty("org.omg.CORBA.ORBInitialHost", "test-server");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");

InitialContext ctx = new InitialContext(props);
TestEJB bean = (TestEJB) ctx.lookup("com.mycode.TestEJB");

I could not figure out why I am getting following exception

java.lang.RuntimeException: java.lang.ClassCastException: com.sun.corba.se.impl.interceptors.ClientRequestInfoImpl cannot be cast to com.sun.corba.ee.spi.legacy.interceptor.RequestInfoExt
at com.sun.enterprise.util.ORBManager.initORB(ORBManager.java:560)
at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:278)
at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:178)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at com.ibi.jsp.util.event.AdminToolManager.runClearning(AdminToolManager.java:558)
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:597)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.ibi.jsp.util.filters.SessionFilter.doFilter(SessionFilter.java:120)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
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.Http11AprProcessor.process(Http11AprProcessor.java:833)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: com.sun.corba.se.impl.interceptors.ClientRequestInfoImpl cannot be cast to com.sun.corba.ee.spi.legacy.interceptor.RequestInfoExt
at com.sun.enterprise.iiop.ClientConnectionInterceptor.send_request(ClientConnectionInterceptor.java:104)
at com.sun.corba.se.impl.interceptors.InterceptorInvoker.invokeClientInterceptorStartingPoint(InterceptorInvoker.java:227)
at com.sun.corba.se.impl.interceptors.PIHandlerImpl.invokeClientPIStartingPoint(PIHandlerImpl.java:323)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:258)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:118)
at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(BootstrapResolverImpl.java:74)
at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(BootstrapResolverImpl.java:107)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(ORBImpl.java:1155)
at com.sun.enterprise.util.ORBManager.initORB(ORBManager.java:548)




Please help as I could not find even a single thread on google that anyone reported such problem.

Thanks,
Mank
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 973
    
    5

Sounds like a classpath/class loader issue to me.

What version of GlassFish you are using?

I believe for GF 3, clients only need the gf-client.jar file. For GF 2 and earlier, appserv-rt.jar and javaee.jar are required (see here for more info).

Assuming you are using GF 2, try removing the files appserv-deployment-client.jar and appserv-ext.jar from tomcat/shared/lib.
Nasir Mkhan
Greenhorn

Joined: May 13, 2001
Posts: 28
Thanks James for your reply. We are using GF 2.1.1.

I did removed appserv-deployment-client.jar and appserv-ext.jar from shared/lib but it gave me "ClassNotFoundException for com.sun.logging.LogDomains" which I see in appserv-deployment-client.jar. I added that jar back and then got "ClassNotFoundException: com.sun.appserv.management.util.misc.RunnableBase$HowToRun" and that class is in appserv-ext.jar. So, when I add that back, I get the original exception posted before.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling glassfish EJB from tomcat
 
Similar Threads
problem with tomcat when i am connection with db2 database
EJB3.0 giving java.lang.ClassCastException: $Proxy81
JBilling trowing exception with JBoss3.x
please help on this error.thanks
Strange Internal Error from JSF