问题描述
activeMQ和spring结合使用,配置文件如下:<?xmlversion="1.0"encoding="UTF-8"?><!--LicensedtotheApacheSoftwareFoundation(ASF)underoneormorecontributorlicenseagreements.SeetheNOTICEfiledistributedwiththisworkforadditionalinformationregardingcopyrightownership.TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0(the"License");youmaynotusethisfileexceptincompliancewiththeLicense.YoumayobtainacopyoftheLicenseathttp://www.apache.org/licenses/LICENSE-2.0Unlessrequiredbyapplicablelaworagreedtoinwriting,softwaredistributedundertheLicenseisdistributedonan"ASIS"BASIS,WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.SeetheLicenseforthespecificlanguagegoverningpermissionsandlimitationsundertheLicense.--><!--STARTSNIPPET:xbean--><beansxmlns="http://www.springframework.org/schema/beans"xmlns:amq="http://activemq.apache.org/schema/core"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://activemq.apache.org/schema/corehttp://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd"><beanid="placeholderConfig"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><propertyname="location"><value>classpath:init.properties</value></property></bean><beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/><!--MySqlDataSourceSampleSetup--><beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close"><propertyname="driverClassName"><value>${dataSource.driverClassName}</value></property><propertyname="url"><value>${dataSource.url}</value></property><propertyname="username"><value>${dataSource.username}</value></property><propertyname="password"><value>${dataSource.password}</value></property><propertyname="poolPreparedStatements"><value>${dataSource.poolPrepared}</value></property><propertyname="initialSize"><value>${dataSource.initialSize}</value></property><propertyname="maxIdle"><value>${dataSource.maxIdle}</value></property><propertyname="minIdle"><value>${dataSource.minIdle}</value></property><propertyname="maxActive"><value>${dataSource.maxActive}</value></property><propertyname="removeAbandoned"><value>${dataSource.removeAbandoned}</value></property><propertyname="removeAbandonedTimeout"><value>${dataSource.removeAbandonedTimeout}</value></property><propertyname="maxWait"><value>${dataSource.maxWait}</value></property></bean><brokerstart="true"useJmx="true"xmlns="http://activemq.apache.org/schema/core"brokerName="testbroker"persistent="true"><destinationPolicy><policyMap><policyEntries><policyEntryqueue=">"producerFlowControl="true"memoryLimit="${broker.queue.memoryLimit}"><pendingMessageLimitStrategy><prefetchRatePendingMessageLimitStrategymultiplier="2.5"/></pendingMessageLimitStrategy></policyEntry><policyEntrytopic=">"producerFlowControl="true"memoryLimit="${broker.topic.memoryLimit}"><pendingSubscriberPolicy><vmCursor/></pendingSubscriberPolicy></policyEntry></policyEntries></policyMap></destinationPolicy><managementContext><managementContextcreateConnector="false"/></managementContext><networkConnectors><networkConnectoruri="static:${broker.tcp.server.url}"name="bridge"dynamicOnly="false"conduitSubscriptions="false"decreaseNetworkConsumerPriority="false"><dynamicallyIncludedDestinations><queuephysicalName="${broker.tcp.dynamical.queueName}"/><topicphysicalName="${broker.tcp.dynamical.topicName}"/></dynamicallyIncludedDestinations></networkConnector></networkConnectors><!--persistenceAdapter持久化配置--><!--dataSource配置数据库--><!--createTablesOnStartup启动时创建数据表--><persistenceAdapter><jdbcPersistenceAdapterdataSource="#dataSource"createTablesOnStartup="true"useDatabaseLock="false"></jdbcPersistenceAdapter></persistenceAdapter><plugins><simpleAuthenticationPlugin><!--该部分是配置发送或接受的用户名和密码,以及所处的用户组--><users><authenticationUserusername="${broker.systemUser.name}"password="${broker.systemUser.password}"groups="users,admins"/></users></simpleAuthenticationPlugin><!--useJAAStoauthenticateusingthelogin.configfileontheclasspathtoconfigureJAAS--><!--以下采用的是JAAS的管理机制来配置各种角色的权限<jaasAuthenticationPluginconfiguration="activemq-domain"/>--><!--letsconfigureadestinationbasedauthorizationmechanism--><authorizationPlugin><map><authorizationMap><authorizationEntries><authorizationEntryqueue=">"read="admins"write="admins"admin="admins"/></authorizationEntries></authorizationMap></map></authorizationPlugin></plugins><systemUsage><systemUsage><memoryUsage><memoryUsagelimit="50mb"/></memoryUsage><storeUsage><storeUsagelimit="100mb"name="foo"/></storeUsage><tempUsage><tempUsagelimit="100mb"/></tempUsage></systemUsage></systemUsage><transportConnectors><transportConnectorname="transConnector"uri="${broker.tcp.server.url}"/></transportConnectors></broker><commandAgentxmlns="http://activemq.apache.org/schema/core"brokerUrl="vm://localhost"username="${broker.systemUser.name}"password="${broker.systemUser.password}"/></beans><!--ENDSNIPPET:xbean-->
在windows启动没有出现任何问题,在部署到linux服务器时,一直在报以下异常:[main][org.apache.activemq.broker.TransportConnector][INFO]-Connectorvm://localhostStarted[ActiveMQTransport:tcp://localhost/127.0.0.1:8509][org.apache.activemq.broker.TransportConnector][INFO]-Connectorvm://testbrokerStopped[ActiveMQTransport:tcp://localhost/127.0.0.1:8509][org.apache.activemq.network.DemandForwardingBridgeSupport][INFO]-testbrokerbridgetotestbrokerstopped[StartLocalBridge:localBroker=vm://testbroker#0][org.apache.activemq.network.DemandForwardingBridgeSupport][WARN]-BridgewasdisposedbeforethestartLocalBridge()methodwasfullyexecuted.[StartLocalBridge:localBroker=vm://testbroker#0][org.apache.activemq.network.DemandForwardingBridgeSupport][WARN]-Networkconnectionbetweenvm://testbroker#0andtcp://localhost/127.0.0.1:8509(testbroker)wasinterruptedduringestablishment.
在Connectorvm://localhostStarted后,马上又Connectorvm://testbrokerStopped,vm连接启动之后马上又停了,导致commandAgent无法和TransportConnector连接,请教各位,这个是什么原因造成的?PS:在windows下配置完全一样,但没出现任何问题。