activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Marini <amar...@net-m.ch>
Subject How configure Jboss to connect to a remote activeMQ broker
Date Fri, 19 Nov 2010 09:46:07 GMT
Hi,

jboss-4.0.5.GA - running on my local machine
activeMQ 5.3.1 - running on a remote machine

Jdk 1.6

I need to configure Jboss jndi Context to connect to a remote activeMQ 
broker.
Using tomcat this configuration is very simple and it's sufficient 
define the jndi resource on context.xml as follow:

<Context>
<Resource
     name="jms/ConnectionFactory"
     auth="Container"
     type="org.apache.activemq.ActiveMQConnectionFactory"
     description="ActiveMQ JMS Connection Factory"
     factory="org.apache.activemq.jndi.JNDIReferenceFactory"
     brokerURL="tcp://remoteBroker:61616"
     brokerName="NetMJMSBroker"/>

<Resource
     name="jms/topicTest"
     auth="Container"
     type="org.apache.activemq.command.ActiveMQTopic"
     description="ActiveMq topic"
     factory="org.apache.activemq.jndi.JNDIReferenceFactory"
     physicalName="topic.test"/>
</Context>

Adding the following jars in the classpath:

activemq-core-5.3.1.jar
commons-logging.jar
geronimo-j2ee-management_1.0_spec-1.0.jar
geronimo-jms_1.1_spec-1.1.1.jar

And nothing more!! it works successful!!

Now,
I would like do the same on Jboss:
Despite the web container embedded on Jboss is still tomcat, I tried to 
use again the same context.xml described above, but without success!

Even though I put it under META-INF or WEB_INF or in another place, 
there's no way to Jboss to load this file!
Anyone could confirm this ?

Said that, second question:
Assuming that I can configure jms datasources using only jboss specifics 
descriptors files, like:
jboss-web.xml, jboss-application.xml and, *-ds.xml to define jms 
datasources...

The only documentation that I found about it is the activeMq jboss 
integration.
My question is:

Should I add all the following resources on jboss classpath even though 
I needn't to configure a broker locally but only configure jndi context 
to connect to a remote broker ?

-add activemq-jms-ds.xml
-add activemq-rar-5.3.1.rar
-configure META_INF/ra.xml under activemq-rar-5.3.1.rar
-configure broker-config.xml under activemq-rar-5.3.1.rar

Third question:
Anyway, I tried to configure the above resources to try to connect to a 
remote broker but without success.
Following how I configured these resources:

- activemq-jms-ds.xml
...
<tx-connection-factory>
<jndi-name>jms/ConnectionFactory</jndi-name>
<xa-transaction/>
<track-connection-by-tx/>
<rar-name>activemq-rar-5.3.1.rar</rar-name>
<connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
<ServerUrl>tcp://remoteBroker:61616</ServerUrl>
</tx-connection-factory>
...

- ra.xml
...
<resourceadapter>
<resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
<config-property>
             ...
<config-property-name>ServerUrl</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>tcp://remoteBroker:61616</config-property-value>
             ...
</resourceadapter>
...

- broker-config.xml
...
<broker useJmx="true" useShutdownHook="false">
...
<transportConnectors>
<transportConnector uri="tcp://remoteBroker:61616"/>
</transportConnectors>
</broker>
...


This is the outcome:

/ERROR [BrokerService] Failed to start ActiveMQ JMS Message Broker. 
Reason: java.io.IOException: Transport Connector could not be registered 
in JMX: Failed to bind to server socket: tcp://remoteBroker:61616 due 
to: java.net.BindException: Can't assign requested address/


Thanks a lot!
Alessandro Marini


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message