突然不发消息给ActiveMQ但能接收

        今天项目在联调过程中,ActiveMQ突然不好使了。在此之前一月内,项目组的人都没有去修改、重启过MQ服务。

        虽然现在知道是由于权限的问题导致只能收不能发(站在ActiveMQ角度是收不到,但可以发)。只是到现在还不知道原来没变过的代码,怎么以前可以用,现在却不行了???

       通过查询示例代码,发现有connectionFactory.setUserName("system");由此联想到,应该跟访问权限的设计有关系。

     查询activemq.home/conf/果然有activemq-security.xml,有关于安全方面的配置示例。查询资料,可以通过设置anonymousAccessAllowed="false"使得MQ不需要密码访问。

     去掉密码是不安全的,但之前没有设置过,真不知道怎么可以突然不行了。疑惑疑惑……

		<plugins>
			<!-- Configure authentication; Username, passwords and groups -->
			<simpleAuthenticationPlugin anonymousAccessAllowed="false">
				<users>
					<authenticationUser username="system" password="${activemq.password}"
						groups="users,admins"/>
					<authenticationUser username="user" password="${guest.password}"
						groups="users"/>
					<authenticationUser username="guest" password="${guest.password}" groups="guests"/>
				</users>
			</simpleAuthenticationPlugin>
        </plugins>

猜你喜欢

转载自simon-fish.iteye.com/blog/1826454