-
Oct 21st, 2011, 08:14 AM
#1
java:comp/env lookup failure when accessing ejb resource ref from spring MDP - WAS 7
Hi Friends,
I am facing a problem which seems like a known issue. Please could someone suggest a solution.
I have an session ejb and have a resource-ref for that ejb defined in my web.xml. I look up that ejb from a class XYZ. When the call to lookup the ejb comes from a servlet, the lookup works fine. However, when the same lookup call occurs via the spring MDP i get an error:
com.rbsg.framework.exception.RBSGApplicationExcept ion - Message Key: FMEWSD011
javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:".]
Which seems understandable since i read that spring container could spawn its own threads which are not managed by the container. But what i dont get is that i have used Spring's WorkManagerTaskExecutor when configuring the JMS MDP, which should use Websphere threads instead of creating its own. I am pasting the JMS MDP setup below, and also the resource-ref defined in the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<import resource="websphere-spring-sender.xml"/>
<bean id="wasDefaultWorkManager"
class="org.springframework.scheduling.commonj.Work ManagerTaskExecutor">
<property name="workManagerName" value="wm/default" />
</bean>
<bean id="wasSIBJMSResourceAdapter"
class="org.springframework.jca.support.ResourceAda pterFactoryBean">
<property name="resourceAdapter">
<bean
class="com.ibm.ws.sib.api.jmsra.impl.JmsJcaResourc eAdapterImpl" />
</property>
<property name="workManager">
<bean
class="org.springframework.jca.work.SimpleTaskWork Manager">
<property name="asyncTaskExecutor"
ref="wasDefaultWorkManager" />
</bean>
</property>
</bean>
<bean id="destination"
class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName" value="jms/CDMAdminMessageTopic" />
</bean>
<bean id="CDMAdminMessageListener" class="com.rbsg.admin.spring.jms.consumer.CDMMessa geConsumer">
<property name="sender" ref="jmsSenderService" />
</bean>
<bean
class="org.springframework.jms.listener.endpoint.J msMessageEndpointManager">
<property name="resourceAdapter" ref="wasSIBJMSResourceAdapter" />
<property name="activationSpec">
<bean
class="com.ibm.ws.sib.api.jmsra.impl.JmsJcaActivat ionSpecImpl">
<property name="destination" ref="destination" />
<property name="destinationType" value="javax.jms.Topic" />
<property name="busName" value="CDM Bus" />
<property name="maxConcurrency" value="5" />
</bean>
</property>
<property name="messageListener" ref="CDMAdminMessageListener" />
</bean>
</beans>
----------------------
web.xml
<ejb-local-ref id="EJBLocalRef_1273484674334">
<description>
</description>
<ejb-ref-name>ejb/DecisionControllerLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.kiq.omega.ods.interfaces.DecisionControll erLocalHome</local-home>
<local>com.kiq.omega.ods.interfaces.DecisionContro llerLocal</local>
<ejb-link>rtds-ejb.jar#DecisionController</ejb-link>
</ejb-local-ref>
Please can someone let me know what i am doing wrong...and also a workaround ...thanks ..in anticipation of ur replies..
Last edited by abhishek.26nov; Oct 21st, 2011 at 08:18 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules