GeeCON Prague 2014*
The moose likes Tomcat and the fly likes Exception while invoking remote EJB methods from tomcat... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Exception while invoking remote EJB methods from tomcat..." Watch "Exception while invoking remote EJB methods from tomcat..." New topic
Author

Exception while invoking remote EJB methods from tomcat...

Prem Shankar
Greenhorn

Joined: Jul 28, 2003
Posts: 21

Hi,

Our application is using tomcat-6.0.18 as a front end server and for backend we are using JBoss 4.0.1Sp1.
I have deployed an ejb in the jboss server and trying to access it from front end. Both the servers are running in the same local machine.
I get the following error whenever home.create(); is called from tomcat. However when the ejb remote methods are called using a simple client(public static void main) it works fine. Also instead of localhost:1099 if I am pointing to a different server it works fine.

Following is the code snippet:This code is called during startup of the server.
public void connection() throws Exception {
System.out.println("Testing EJB Connection");
Context ctx = getInitialContext();
Object objref = ctx.lookup("CRUD");
Class clazz = getHomeClass("CRUD", objref);
CRUDHome home = (CRUDHome) PortableRemoteObject.narrow(objref, clazz);
CRUDRemote crudService = home.create();
List communityStatus = crudService.search(new CommunityStatusDTO());
System.out.println("Tested EJB Connection--"+communityStatus.size());

}

private Context getInitialContext() throws Exception {
//TODO: remove hard coding.
Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");

p.put("java.naming.provider.url", "jnp://localhost:1099");
p.put("java.naming.factory.url.pkgs",
"org.jboss.namingrg.jnp.interfaces");

return new InitialContext(p);
}

The same code snippet when invoked using a client is getting fired without any exeption.

Following is the stack trace of exception when called within Tomcat:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.RuntimeException: java.rmi.ConnectException: Failure during invoke; nested exception is:
java.io.EOFException
at com.tollbrothers.archonline.ui.bean.StaticDataLoader.postProcessBeanFactory(StaticDataLoader.java:30)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:554)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:545)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:363)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
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.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.rmi.ConnectException: Failure during invoke; nested exception is:
java.io.EOFException
at org.jboss.invocation.pooled.interfaces.PooledInvokerProxy.invoke(PooledInvokerProxy.java:676)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:63)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:184)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy3.create(Unknown Source)
at com.tollbrothers.archonline.ui.bean.LookupData.connection(LookupData.java:519)
at com.tollbrothers.archonline.ui.bean.LookupData.populateStaticData(LookupData.java:89)
at com.tollbrothers.archonline.ui.bean.LookupData.populateData(LookupData.java:73)
at com.tollbrothers.archonline.ui.bean.StaticDataLoader.postProcessBeanFactory(StaticDataLoader.java:25)
... 30 more
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2554)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1297)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at org.jboss.invocation.pooled.interfaces.PooledInvokerProxy.invoke(PooledInvokerProxy.java:654)


Any help would be appreciated. Thanks in advance




Regards,
PremShankar N.
 
GeeCON Prague 2014
 
subject: Exception while invoking remote EJB methods from tomcat...