Maven 运行integrat后,activeMQ平稳关闭

Maven 运行integrat后,activeMQ平稳关闭,maven,testing,jms,activemq,Maven,Testing,Jms,Activemq,我正在使用ActiveMQ运行使用mvn构建的集成测试。My pom.xml首先触发activemq,然后触发集成测试,以便它们可以使用上述activemq实例传输消息 它工作正常,但不能顺利关闭。。当mvn构建完成并且所有测试都成功时,构建看起来很好。但是activemq在关闭时抛出以下错误:- '[INFO] Apache ActiveMQ 5.7.0 (localhost, ID:LB3290FPF-54398-1427490319466-0:1) is shutting down Exc

我正在使用ActiveMQ运行使用mvn构建的集成测试。My pom.xml首先触发activemq,然后触发集成测试,以便它们可以使用上述activemq实例传输消息

它工作正常,但不能顺利关闭。。当mvn构建完成并且所有测试都成功时,构建看起来很好。但是activemq在关闭时抛出以下错误:-

'[INFO] Apache ActiveMQ 5.7.0 (localhost, ID:LB3290FPF-54398-1427490319466-0:1) is shutting down
Exception in thread "ActiveMQ ShutdownHook" java.lang.NoClassDefFoundError: org/apache/activemq/transport/vm/VMTransportFactory
at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:750)
at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:91)
at org.apache.activemq.broker.BrokerService.containerShutdown(BrokerService.java:2303)
at org.apache.activemq.broker.BrokerService$6.run(BrokerService.java:2270)
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.transport.vm.VMTransportFactory
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 4 more
[INFO] Connector tcp://localhost:61616?useJmx=true&persistent=false Stopped'
有没有一种方法可以让Maven在Maven构建完成时顺利关闭activeMQ而不出现上述异常?以下是一些相关的详细信息:-

  • activeMQ uri:tcp://localhost:61616?useJmx=false&persistent=false
  • 福克:是的
  • activeMQ核心:5.7.0
  • maven activemq插件:5.7.0

  • 您需要将
    useShutdownHook=“false”
    添加到XML配置的
    元素中。当嵌入ActiveMQ且未正确配置时,会发生此问题

    示例配置:

    <amq:broker useJmx="false" persistent="false" useShutdownHook="false">
    ...
    </amq:broker>
    


    希望有帮助。

    集成测试完成后,您可以停止activemq实例。只需在pom中添加以下行

    <execution>
        <id>stop-activemq</id>
        <goals>
             <goal>stop</goal>
        </goals>
        <phase>post-integration-test</phase>
    </execution>
    
    
    停止activemq
    停止
    整合后测试
    
    还有,您找到解决方案了吗?