Announcement Announcement Module
No announcement yet.
java:comp/env lookup failure when accessing ejb resource ref from spring MDP - WAS 7 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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" "">

    <import resource="websphere-spring-sender.xml"/>

    <bean id="wasDefaultWorkManager"
    class="org.springframework.scheduling.commonj.Work ManagerTaskExecutor">
    <property name="workManagerName" value="wm/default" />

    <bean id="wasSIBJMSResourceAdapter"
    class=" pterFactoryBean">
    <property name="resourceAdapter">
    class=" eAdapterImpl" />
    <property name="workManager">
    class=" Manager">
    <property name="asyncTaskExecutor"
    ref="wasDefaultWorkManager" />

    <bean id="destination"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName" value="jms/CDMAdminMessageTopic" />

    <bean id="CDMAdminMessageListener" class="com.rbsg.admin.spring.jms.consumer.CDMMessa geConsumer">
    <property name="sender" ref="jmsSenderService" />

    class="org.springframework.jms.listener.endpoint.J msMessageEndpointManager">
    <property name="resourceAdapter" ref="wasSIBJMSResourceAdapter" />
    <property name="activationSpec">
    class=" ionSpecImpl">
    <property name="destination" ref="destination" />
    <property name="destinationType" value="javax.jms.Topic" />
    <property name="busName" value="CDM Bus" />
    <property name="maxConcurrency" value="5" />
    <property name="messageListener" ref="CDMAdminMessageListener" />


    <ejb-local-ref id="EJBLocalRef_1273484674334">
    <local-home> erLocalHome</local-home>
    <local> llerLocal</local>

    Please can someone let me know what i am doing wrong...and also a workaround ...thanks anticipation of ur replies..
    Last edited by abhishek.26nov; Oct 21st, 2011, 08:18 AM.

  • #2
    You should lookup the Server Runtime MBean with JNDI java:comp/jmx/runtime rather than java:comp/env/jmx/runtime