This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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

Exception while invoking remote EJB methods from tomcat...

Prem Shankar

Joined: Jul 28, 2003
Posts: 21


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 = 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.provider.url", "jnp://localhost:1099");

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:
at com.tollbrothers.archonline.ui.bean.StaticDataLoader.postProcessBeanFactory(
at org.springframework.web.context.ContextLoader.createWebApplicationContext(
at org.springframework.web.context.ContextLoader.initWebApplicationContext(
at org.springframework.web.context.ContextLoaderListener.contextInitialized(
at org.apache.catalina.core.StandardContext.listenerStart(
at org.apache.catalina.core.StandardContext.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployDescriptor(
at org.apache.catalina.startup.HostConfig.deployDescriptors(
at org.apache.catalina.startup.HostConfig.deployApps(
at org.apache.catalina.startup.HostConfig.start(
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardHost.start(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardEngine.start(
at org.apache.catalina.core.StandardService.start(
at org.apache.catalina.core.StandardServer.start(
at org.apache.catalina.startup.Catalina.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.catalina.startup.Bootstrap.start(
at org.apache.catalina.startup.Bootstrap.main(
Caused by: java.rmi.ConnectException: Failure during invoke; nested exception is:
at org.jboss.invocation.pooled.interfaces.PooledInvokerProxy.invoke(
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(
at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(
at org.jboss.proxy.TransactionInterceptor.invoke(
at org.jboss.proxy.SecurityInterceptor.invoke(
at org.jboss.proxy.ejb.HomeInterceptor.invoke(
at org.jboss.proxy.ClientContainer.invoke(
at $Proxy3.create(Unknown Source)
at com.tollbrothers.archonline.ui.bean.LookupData.connection(
at com.tollbrothers.archonline.ui.bean.LookupData.populateStaticData(
at com.tollbrothers.archonline.ui.bean.LookupData.populateData(
at com.tollbrothers.archonline.ui.bean.StaticDataLoader.postProcessBeanFactory(
... 30 more
Caused by:
at org.jboss.invocation.pooled.interfaces.PooledInvokerProxy.invoke(

Any help would be appreciated. Thanks in advance

PremShankar N.
I agree. Here's the link:
subject: Exception while invoking remote EJB methods from tomcat...
It's not a secret anymore!