JBoss EAP6与外部HornetQ实现的连接不起作用,但与JBoss 7.1.1有关

时间:2013-02-12 22:37:56

标签: java spring jboss jms hornetq

我正在试用JBoss AS EAP6。

但是我有使用JBoss AS 7.1.1实现的系统解决方案。和外部HornetQ 2.1.14实现。这适用于JBoss 7.1.1,但EAP 6无法连接到HornetQ。

我正在以localhost身份运行。是不是这样的情况,或者我错过了什么,配置错了?

HornetQ配置:

将hornetq-beans.xml文件

<?xml version="1.0" encoding="UTF-8"?>

<deployment xmlns="urn:jboss:bean-deployer:2.0">

   <bean name="Naming" class="org.jnp.server.NamingBeanImpl"/>

   <!-- JNDI server. Disable this if you don't want JNDI -->
   <bean name="JNDIServer" class="org.jnp.server.Main">
      <property name="namingInfo">
     <inject bean="Naming"/>
      </property>
      <property name="port">${jnp.port:1099}</property>
      <property name="bindAddress">${jnp.host:localhost}</property>
      <property name="rmiPort">${jnp.rmiPort:1098}</property>
      <property name="rmiBindAddress">${jnp.host:localhost}</property>
   </bean>

   <!-- MBean server -->
   <bean name="MBeanServer" class="javax.management.MBeanServer">
      <constructor factoryClass="java.lang.management.ManagementFactory"
           factoryMethod="getPlatformMBeanServer"/>
   </bean> 

   <!-- The core configuration -->
   <bean name="Configuration" class="org.hornetq.core.config.impl.FileConfiguration">
   </bean>

    <!-- The security manager -->
   <bean name="HornetQSecurityManager" class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl">
      <start ignored="true"/>
      <stop ignored="true"/>
   </bean>

    <!-- The core server -->
   <bean name="HornetQServer" class="org.hornetq.core.server.impl.HornetQServerImpl">
      <constructor>
     <parameter>
        <inject bean="Configuration"/>
     </parameter>
     <parameter>
        <inject bean="MBeanServer"/>
     </parameter>
     <parameter>
        <inject bean="HornetQSecurityManager"/>
     </parameter>        
      </constructor>
      <start ignored="true"/>
      <stop ignored="true"/>
   </bean>

   <!-- The JMS server -->
   <bean name="JMSServerManager" class="org.hornetq.jms.server.impl.JMSServerManagerImpl">
      <constructor>         
     <parameter>
        <inject bean="HornetQServer"/>
     </parameter>         
      </constructor>
   </bean>


</deployment>

hornetq-configuration.xml文件

<configuration xmlns="urn:hornetq"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

   <clustered>true</clustered>

   <paging-directory>${data.dir:../data}/node-a/paging</paging-directory>

   <bindings-directory>${data.dir:../data}/node-a/bindings</bindings-directory>

   <journal-directory>${data.dir:../data}/node-a/journal</journal-directory>

   <journal-min-files>10</journal-min-files>

   <large-messages-directory>${data.dir:../data}/node-a/large-messages</large-messages-directory>

   <connectors>      
      <connector name="netty">
     <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
     <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
     <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
      </connector>

      <connector name="netty-throughput">
     <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
     <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
     <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
     <param key="batch-delay" value="50"/>
      </connector>
   </connectors>

   <acceptors>
      <acceptor name="netty">
     <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
     <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
     <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
      </acceptor>

      <acceptor name="netty-throughput">
     <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
     <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
     <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
     <param key="batch-delay" value="50"/>
     <param key="direct-deliver" value="false"/>
      </acceptor>
   </acceptors>

   <broadcast-groups>
      <broadcast-group name="bg-group1">
     <group-address>231.7.7.7</group-address>
     <group-port>9876</group-port>
     <broadcast-period>5000</broadcast-period>
     <connector-ref>netty</connector-ref>
      </broadcast-group>
   </broadcast-groups>

   <discovery-groups>
      <discovery-group name="dg-group1">
     <group-address>231.7.7.7</group-address>
     <group-port>9876</group-port>
     <refresh-timeout>10000</refresh-timeout>
      </discovery-group>
   </discovery-groups>

   <cluster-connections>
      <cluster-connection name="my-cluster">
     <address>jms</address>  
     <connector-ref>netty</connector-ref>
         <retry-interval>500</retry-interval>
         <forward-when-no-consumers>true</forward-when-no-consumers>
         <max-hops>1</max-hops>
         <discovery-group-ref discovery-group-name="dg-group1"/>
      </cluster-connection>
   </cluster-connections>

   <security-settings>
      <security-setting match="#">
     <permission type="createNonDurableQueue" roles="guest"/>
     <permission type="deleteNonDurableQueue" roles="guest"/>
     <permission type="consume" roles="guest"/>
     <permission type="send" roles="guest"/>
      </security-setting>
   </security-settings>

   <address-settings>
      <!--default for catch all-->
      <address-setting match="#">
     <dead-letter-address>jms.queue.DLQ</dead-letter-address>
     <expiry-address>jms.queue.ExpiryQueue</expiry-address>
     <redelivery-delay>0</redelivery-delay>
     <max-size-bytes>10485760</max-size-bytes>       
     <message-counter-history-day-limit>10</message-counter-history-day-limit>
     <address-full-policy>BLOCK</address-full-policy>
         <redistribution-delay>1000</redistribution-delay>
      </address-setting>
   </address-settings>



</configuration>

JBoss EAP 6配置

独立-ha.xml

该文件的关键部分如下:

<extensions>
    <extension module="org.jboss.as.clustering.infinispan"/>
    <extension module="org.jboss.as.clustering.jgroups"/>
    <extension module="org.jboss.as.configadmin"/>
    <extension module="org.jboss.as.connector"/>
    <extension module="org.jboss.as.deployment-scanner"/>
    <extension module="org.jboss.as.ee"/>
    <extension module="org.jboss.as.ejb3"/>
    <extension module="org.jboss.as.jaxrs"/>
    <extension module="org.jboss.as.jdr"/>
    <extension module="org.jboss.as.jmx"/>
    <extension module="org.jboss.as.jpa"/>
    <extension module="org.jboss.as.logging"/>
    <extension module="org.jboss.as.mail"/>
    <extension module="org.jboss.as.modcluster"/>
    <extension module="org.jboss.as.naming"/>
    <extension module="org.jboss.as.osgi"/>
    <extension module="org.jboss.as.pojo"/>
    <extension module="org.jboss.as.remoting"/>
    <extension module="org.jboss.as.sar"/>
    <extension module="org.jboss.as.security"/>
    <extension module="org.jboss.as.threads"/>
    <extension module="org.jboss.as.transactions"/>
    <extension module="org.jboss.as.web"/>
    <extension module="org.jboss.as.webservices"/>
    <extension module="org.jboss.as.weld"/>
    <extension module="org.jboss.snowdrop"/>
</extensions>

<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
    </interface>
    <interface name="public">
        <inet-address value="${jboss.bind.address:127.0.0.1}"/>
    </interface>
    <interface name="unsecure">
        <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
    </interface>
</interfaces>

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
    <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
    <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
    <socket-binding name="ajp" port="8009"/>
    <socket-binding name="http" port="8080"/>
    <socket-binding name="https" port="8443"/>
    <socket-binding name="jgroups-diagnostics" port="0" multicast-address="224.0.75.75" multicast-port="7500"/>
    <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
    <socket-binding name="jgroups-tcp" port="7600"/>
    <socket-binding name="jgroups-tcp-fd" port="57600"/>
    <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
    <socket-binding name="jgroups-udp-fd" port="54200"/>
    <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
    <socket-binding name="osgi-http" interface="management" port="8090"/>
    <socket-binding name="remoting" port="4447"/>
    <socket-binding name="txn-recovery-environment" port="4712"/>
    <socket-binding name="txn-status-manager" port="4713"/>
    <outbound-socket-binding name="mail-smtp">
        <remote-destination host="localhost" port="25"/>
    </outbound-socket-binding>
</socket-binding-group>

1 个答案:

答案 0 :(得分:2)

这将不兼容..较新的库无法与较旧的服务器通信。

直到HOrnetQ 2.2,我们根本不支持协议上的不同版本,我们在2.2之后开始考虑兼容性......所以你想要实现的目标是行不通的。