-
Sep 29th, 2006, 12:51 PM
#1
"Occasional" JMS NoSuchBeanDefinitionException
Hi we are using weblogic 8.1 and use spring framework within EJB to send JMS messages. This works fine. However, we occasionally encounter NoSuchBeanDefinitionException. No idea why this would occur.
Thanks for your help.
xml file:
<bean id="toComplianceReqQueue" class="org.springframework.jms.core.JmsTemplate102 " lazy-init="true">
<property name="connectionFactory">
<ref bean="jmsQueueConnectionFactory"/>
</property>
<property name="destinationResolver">
<ref bean="jmsDestinationResolver"/>
</property>
<property name="pubSubDomain">
<value>false</value>
</property>
<property name="defaultDestinationName">
<value>${compliance.request.queue}</value>
</property>
</bean>
Java code:
private void sendComplianceMessage(String complianceMessage)
throws ComplianceUnavailableException {
// Use JMS framework to send a request
CommonMessageUtility lUtil = CommonMessageUtility.getInstance();
try {
lUtil.setupAppContext((ApplicationContext) getBeanFactory());
} catch (BeansException e) {
logger
.error(
"There is an error at initializing the settings for messaging.Either the compliance message destinations are down or unreachable",
e);
JmsTemplate102 lSender = (JmsTemplate102) JMSContext.getInstance().getBean(aDestination);
lSender.convertAndSend(aSendObject); <------ throws exception
Exception:
org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'toComplianceReqQueue' is defined
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.getBeanDefinition(DefaultListab leBeanFactory.java:352)
at org.springframework.beans.factory.support.Abstract BeanFactory.getMergedBeanDefinition(AbstractBeanFa ctory.java:671)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:555)
at com.wellmanage.investsys.jms.context.JMSContext.ge tBean(JMSContext.java:112)
at com.wellmanage.investsys.jms.framework.CommonMessa geUtility.send(CommonMessageUtility.java:202)
at com.wellmanage.investsys.cci.server.request.Reques tManagerBean.sendComplianceMessage(RequestManagerB ean.java:283)
at com.wellmanage.investsys.cci.server.request.Reques tManagerBean.checkBasket(RequestManagerBean.java:2 45)
at com.wellmanage.investsys.cci.server.request.Reques tManager_omf7ik_EOImpl.checkBasket(RequestManager_ omf7ik_EOImpl.java:106)
at com.wellmanage.investsys.cci.server.request.Reques tManager_omf7ik_EOImpl_WLSkel.invoke(Unknown Source)
-
Oct 6th, 2006, 10:29 AM
#2
Any chance that you might have crossed a classloader boundary in your application? I noticed the "cci" in the package hierarchy. I was wondering if the problem was sporadic not because it is random, but maybe you are sometimes invoking the code in different class loaders, one of which is consistently working, the other more infrequently used but never working.
The only other thought is that you might want to turn up the logging or weave in extra logging on the bean factories to see if Spring saw your bean definition but was unable to register it for some reason.
-
Nov 4th, 2006, 10:06 PM
#3
Thanks for your help,Reid. I guess the issue was caused by some bad thread programming elsewhere. Your idea of ClassLoader not working seems to fit this !
-
Jan 26th, 2007, 02:59 PM
#4
NoSuchBeanDefinitionException - Spring Container
Hello rkr,
Could you please let me know what did you find out regarding your issue regarding the NoSuchBeanDefinitionException ? I am facing a similar issue intermittently and I do have multiple threads accessing the Spring Container (in ApplicationContext) through a Transaction Manager utility class. When I have one thread using one instance of TransactionManager there is no issue, but when I share the TransactionManager among multiple threads I get this issue.
Last edited by Domarp_Rian; Jan 29th, 2007 at 09:21 AM.
-
Feb 1st, 2007, 10:29 PM
#5
I still haven't found a solution. Let me know how it works for you
-
Feb 7th, 2007, 10:20 AM
#6
I haven't found the real cause or solution. I could not reproduce it later on. But I believe my issue also is with regards to some threading raise conditions. I am using ThreadLocal extensively for session, transaction management and this seem to be an issue when multiple threads are trying to use the same transaction management utility instance.
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