删除系统角色失败:Uncategorized exception occured during JMS processing; nested exception is org.apache.activemq.ConnectionFailedException: The JMS connection has failed: Connection reset
org.springframework.jms.UncategorizedJmsException: Uncategorized exception occur
ed during JMS processing; nested exception is weblogic.jms.common.JMSException:
could not find Server JmsManaged_7030; nested exception is weblogic.jms.common.J
MSException: could not find Server JmsManaged_7030
上Weblogic控制台查看运行状态,发现队列配置正确且正常运行,排除配置问题。
分析程序,在JMS配置文件JmsA.xml中发现如下内容:
<bean id="jmsConnectionFactoryForA" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
</bean>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
......
......
</bean>
在JMS配置文件JmsB.xml中发现如下内容:
<bean id="jmsConnectionFactoryForB" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
</bean>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
......
......
</bean>
问题就发生在
jndiTemplate上。由于默认配置Spring按名字匹配,而系统中定义了不止一个
jndiTemplate
,故无法找到匹配的jndiTemplate,发生问题。将JmsA.xml中将jndiTemplate改为jndiTemplateForA,将JmsB.xml中则改为jndiTemplateForB,并相应修改引用的地方,重新测试OK。
建议:给bean的id命名时要避免重名,通常可以采用添加后缀的形式。