`

Sping整合ActiveMQ(五.常见错误分析)

阅读更多

问题一:每条消息重复接收

使用spring配置activemq监听消息时,发现每条消息总是重复接收,每次都是两条完全相同的消息同时打印在控制台。在google和百度中查询 了很久未发现类似的情况。查看activemq服务端,发现每次web容器启动Cunsumer总是增加两个,估计是web.xml中配置出现问题,遂检 查之,发现contextConfigLocation配置重复

<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>classpath*:spring.xml;classpath*:spring/spring*.xml;</param-value>
</context-param>
<listener>
	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
	<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
	<init-param>
	    <param-name>contextConfigLocation</param-name>
	    <param-value>classpath:spring.xml</param-value>
	</init-param>
	<load-on-startup>1</load-on-startup>
</servlet>

 删除 context-param,listener标签中的内容
修改 init-param内容为

<init-param>
	  <param-name>contextConfigLocation</param-name>
	  <param-value>classpath*:spring.xml,classpath*:spring/spring*.xml</param-value>
</init-param>

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics