Hello,
We are using WAS 5.1 we get a JNDI lookup naming exception.
NameNotFoundException :-
[26/05/05 14:18:12:134 EST] 1654a121 DefaultListab I org.springframework.beans.factory.support.DefaultL istableBeanFactory Creating shared instance of singleton bean 'loaderQueue'
[26/05/05 14:18:12:134 EST] 1654a121 DefaultListab I org.springframework.beans.factory.support.DefaultL istableBeanFactory Creating shared instance of singleton bean 'extractorSession'
[26/05/05 14:18:12:197 EST] 1654a121 DefaultListab I org.springframework.beans.factory.support.DefaultL istableBeanFactory Destroying singletons in factory {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [extractorQueueConnectionFactory,loaderQueueConnect ionFactory,extractorQueue,loaderQueue,extractorSes sion,loaderSession,messageLoaderSession,schemaInst anceLoaderSession,senderSession]; root of BeanFactory hierarchy}
Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'extractorSession' defined in class path resource [applicationContext-ejb.xml]: Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: Context: mbkw055227/nodes/mbkw055227/servers/server1, name: ejb/session/OTKR/ExtractorSessionBean: First component in name ejb/session/OTKR/ExtractorSessionBean not found.
Code:-
Here is the reference in the applicationContext-ejb.xml file
<bean id="loaderQueue"
class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>jms/queue/OTKR/LoaderQueue</value>
</property>
</bean>
<bean id="extractorSession"
class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>ejb/session/ExtractorSessionBean</value>
</property>
</bean>
We look this up from the ejbCreate() of our MessageDrivenBean code:-
Here is the x-doclet references in the header of MessageDrivenBean:-
Below are the xdoclet-related tags needed for this EJB.
*
* @ejb.resource-ref res-ref-name="jms/queue/OTKR/LoaderQueueConnectionFactory"
* res-type="javax.jms.QueueConnectionFactory"
* res-auth="Container"
* jndi-name="java:comp/env/jms/queue/OTKR/LoaderQueueConnectionFactory"
*
* @ejb.ejb-ref ejb-name="LoaderSessionBean" view-type="local"
* ref-name="ejb/session/OTKR/LoaderSessionBean"
*
* @ejb.bean name="LoaderMessageDrivenBean"
* display-name="LoaderMessageDrivenBean"
* description="This is a message-driven bean which reads messages off
* the loader input queue and then calls the loader bean to perform
* loading of products and sends to the extractor input queue"
* destination-type="javax.jms.Queue"
* transaction-type="Container"
*/
ejbCreate method code:-
public void ejbCreate()
{
logger.debug("ejbCreate [start]");
try
{
logger.debug("looking up queue connection");
InitialContext initialContext = new InitialContext();
// define the queue connection factory
QueueConnectionFactory qcf = (QueueConnectionFactory) ApplicationContextEJB.getInstance().getBean(Applic ationContextEJB.LOADER_QUEUE_CONNECTION_FACTORY);
logger.debug("looking up queue connection[done]");
connection = qcf.createQueueConnection();
logger.debug("creating queue connection");
session = connection.createQueueSession(true, 0);
logger.debug("looked up queue connection");
connection.start();
logger.debug("queue connection [started]");
// define the extractor session bean
LoaderSessionBeanLocalHome loaderSessionBeanLocalHome = (LoaderSessionBeanLocalHome) ApplicationContextEJB.getInstance().getBean(Applic ationContextEJB.LOADER_SESSION);
loaderSessionBeanLocal = loaderSessionBeanLocalHome.create();
logger.debug("ejbCreate [end]");
}
catch (NamingException ne)
{
logger.error("jndi naming failure [" + ne.getMessage() + "]", ne);
}
catch (CreateException ce)
{
logger.error("ejb create failure [" + ce.getMessage() + "]", ce);
}
catch (JMSException je)
{
logger.error("queue connection failure [" + je.getMessage() + "]", je);
}
}
Then in WAS 5.1when we install our EJB reference JNDI is
ejb/session/OTKR/ExtractorSessionBean.
We've tried java:comp/env/ejb/session/OTKR/ExtractorSessionBean
and variances of this.
Before we put Spring JNDI lookup in we used this full reference from an initialContext.lookup() and it worked.
Any help appreciated.


Reply With Quote