aspose file tools*
The moose likes Tomcat and the fly likes Accessing EJBs in Weblogic from Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Accessing EJBs in Weblogic from Tomcat" Watch "Accessing EJBs in Weblogic from Tomcat" New topic
Author

Accessing EJBs in Weblogic from Tomcat

Venkatesh Walajabad
Greenhorn

Joined: Nov 15, 2004
Posts: 2
Hi

I am trying to access an EJB deployed in a weblogic server environment (Weblogic 9.2) from Tomcat 6.0 . I would be interested to know what kind of config changes do I need to make on the Tomcat side to make it working.

This is my jndi config from my application deployed in Tomcat

<bean id="dataService" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
<property name="jndiName" value="java:/comp/env/priceservice/ejb/PriceService"/>
<property name="businessInterface" value="com.service.DataService"/>
</bean>

I have included ejb-ref in my web.xml

<ejb-ref>
<ejb-ref-name>priceservice/ejb/PriceService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<ejb-ref-home>com.service.price.ejb.PriceServiceHome</ejb-ref-home>
<ejb-ref-remote>com.service.DataService</ejb-ref-remote>
</ejb-ref>

This is my context.xml from Tomcat

<Ejb name="priceservice/ejb/PriceService" type="Session" home="com.service.price.ejb.PriceServiceHome" remote="com.service.XConDataService"/>
<ResourceParams name="priceservice/ejb/PriceService">
<parameter>
<name>factory</name>
<value>com.amity.utils.tomcat.EJBRefFactory</value>
</parameter>
<parameter>
<name>java.naming.provider.url</name>
<value>t3://localhost:7001</value>
</parameter>
<parameter>
<name>jndi-name</name>
<value>PriceService</value>
</parameter>
</ResourceParams>

And this is the error I see in Tomcat logs

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'anXConDataService' defined in URL [file:/C:/Program%20Files/apache-tomcat-6.0.16/webapps/onlinemarketdata/WEB-INF/classes/OnlineMarketData-jndi.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [java:/comp/env/priceservice/ejb/PriceService] not found: JNDI implementation returned null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:217)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
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:4350)
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.deployWAR(HostConfig.java:829)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:718)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
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:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: javax.naming.NameNotFoundException: JNDI object with [java:/comp/env/priceservice/ejb/PriceService] not found: JNDI implementation returned null
 
Consider Paul's rocket mass heater.
 
subject: Accessing EJBs in Weblogic from Tomcat