tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emanuele Villa <emanuele.vi...@bravofly.com>
Subject TomEE + HornetQ standalone
Date Wed, 21 Aug 2013 08:19:03 GMT
Hi,

we're trying to connect from our application deployed into a TomEE+ to a
standalone HornetQ 2.3.0 but with no successful results... Is there anyone
who had tried a similar integration successfully? We'll appreciate very much
a support in this way!

We have downloaded and started our HornetQ (2.3.0-Final) standalone instance
with no change to configuration files (we're using the default provided
configuration); we have done the following changes in our TomEE instance
(following the official JBoss and TomEE documentation plus the following
post: http://lucamerolla.wordpress.com/2011/06/10/openejb-and-hornetq/):

*1 - In hornetq-ra-rar example project (downloaded from the official jboss
hornetq web-site) we create a file called service-jar.xml under the path
hornetq-ra-rar/src/main/resources/ord/hornetq/ra/ with the following
content:*

<?xml version="1.0" encoding="UTF-8"?>
<ServiceJar>
  
  <ServiceProvider
          id="HornetQ MDB Container"
          service="Container"
          types="MESSAGE"
          constructor="id, securityService, ResourceAdapter,
MessageListenerInterface, ActivationSpecClass, InstanceLimit"
          class-name="org.apache.openejb.core.mdb.MdbContainer">

    ResourceAdapter HornetQ JMS Resource Adapter
    MessageListenerInterface javax.jms.MessageListener
    ActivationSpecClass org.hornetq.ra.inflow.HornetQActivationSpec
    InstanceLimit 10

  </ServiceProvider>

  
  <ServiceProvider
          id="HornetQ JMS Resource Adapter"
          service="Resource"
          types="HornetQResourceAdapter"
          class-name="org.hornetq.ra.HornetQResourceAdapter">

    DataSource Default Unmanaged JDBC Database

  </ServiceProvider>

  <ServiceProvider
          id="HornetQ JMS Connection Factory"
          service="Resource"
          types="javax.jms.ConnectionFactory,
javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory,
QueueConnectionFactory, TopicConnectionFactory"
          class-name="org.hornetq.ra.HornetQRAManagedConnectionFactory">

    ResourceAdapter HornetQ JMS Resource Adapter
    TransactionSupport xa
    PoolMaxSize 10
    PoolMinSize 0
    ConnectionMaxWaitMilliseconds 5000
    ConnectionMaxIdleMinutes 15

  </ServiceProvider>

  	<ServiceProvider
          id="Default Queue"
          service="Resource"
          types="javax.jms.Queue, Queue"
          constructor="destination"
          class-name="org.hornetq.jms.client.HornetQQueue">
	</ServiceProvider>

  	<ServiceProvider
          id="Default Topic"
          service="Resource"
          types="javax.jms.Topic, Topic"
          constructor="destination"
          class-name="org.hornetq.jms.client.HornetQTopic">
	</ServiceProvider>

</ServiceJar>

*2 - In hornetq-ra-rar example project (the same of previous point) we
changed the content of the file ra.xml as below:*

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



<connector xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
           http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
           version="1.5">

   <description>HornetQ 2.0 Resource Adapter</description>
   <display-name>HornetQ 2.0 Resource Adapter</display-name>

   <vendor-name>Red Hat Middleware LLC</vendor-name>
   <eis-type>JMS 1.1 Server</eis-type>
   <resourceadapter-version>1.0</resourceadapter-version>

   <license>
      <description>
Copyright 2009 Red Hat, Inc.
 Red Hat licenses this file to you under the Apache License, version
 2.0 (the "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at
   http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 implied.  See the License for the specific language governing
 permissions and limitations under the License.  
      </description>
      <license-required>true</license-required>
   </license>

   <resourceadapter>
     
<resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter</resourceadapter-class>
      <config-property>
         <description>
            The transport type. Multiple connectors can be configured by
using a comma separated list,
            i.e.
org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,org.hornetq.core.remoting.impl.invm.InVMConnectorFactory.
         </description>
         <config-property-name>ConnectorClassName</config-property-name>
         <config-property-type>java.lang.String</config-property-type>
        
*<config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property-value>*
      </config-property>
      <config-property>
         <description>The transport configuration. These values must be in
the form of key=val;key=val;,
            if multiple connectors are used then each set must be separated
by a comma i.e. host=host1;port=5445,host=host2;port=5446.
            Each set of params maps to the connector classname specified.
         </description>
         <config-property-name>ConnectionParameters</config-property-name>
         <config-property-type>java.lang.String</config-property-type>
        
*<config-property-value>host=127.0.0.1;port=5445</config-property-value>*
      </config-property>

      <outbound-resourceadapter>
         <connection-definition>
           
<managedconnectionfactory-class>org.hornetq.ra.HornetQRAManagedConnectionFactory</managedconnectionfactory-class>

            <config-property>
               <description>The default session type</description>
              
<config-property-name>SessionDefaultType</config-property-name>
               <config-property-type>java.lang.String</config-property-type>
              
<config-property-value>javax.jms.Queue</config-property-value>
            </config-property>
            <config-property>
               <description>Try to obtain a lock within specified number of
seconds; less than or equal to 0 disable this functionality</description>
               <config-property-name>UseTryLock</config-property-name>
              
<config-property-type>java.lang.Integer</config-property-type>
               <config-property-value>0</config-property-value>
            </config-property>

           
<connectionfactory-interface>org.hornetq.ra.HornetQRAConnectionFactory</connectionfactory-interface>
           
<connectionfactory-impl-class>org.hornetq.ra.HornetQRAConnectionFactoryImpl</connectionfactory-impl-class>
            <connection-interface>javax.jms.Session</connection-interface>
           
<connection-impl-class>org.hornetq.ra.HornetQRASession</connection-impl-class>
         </connection-definition>
         <transaction-support>XATransaction</transaction-support>
         <authentication-mechanism>
           
<authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
           
<credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
         </authentication-mechanism>
         <reauthentication-support>false</reauthentication-support>
      </outbound-resourceadapter>

      <inbound-resourceadapter>
         <messageadapter>
            <messagelistener>
              
<messagelistener-type>javax.jms.MessageListener</messagelistener-type>
               <activationspec>
                 
<activationspec-class>org.hornetq.ra.inflow.HornetQActivationSpec</activationspec-class>
                  <required-config-property>
                     
<config-property-name>destination</config-property-name>
                  </required-config-property>
               </activationspec>
            </messagelistener>
         </messageadapter>
      </inbound-resourceadapter>

   </resourceadapter>
</connector>

*3 - we build with maven hornetq-ra-rar project (it includes the previous
two files service-jar.xml and ra.xml) and we put the generated
hornetq-rar-2.3.0.Final-sources.jar under TomEE lib folder with the
following hornetq jars list:*

hornetq-commons-2.3.0.Final.jar
hornetq-core-client-2.3.0.Final.jar
hornetq-jms-client-2.3.0.Final.jar
hornetq-jms-server-2.3.0.Final.jar
hornetq-journal-2.3.0.Final.jar
hornetq-ra-2.3.0.Final.jar
hornetq-rar-2.3.0.Final-sources.jar
hornetq-server-2.3.0.Final.jar
jboss-common-core-2.2.14.GA.jar
jboss-connector-api_1.5_spec-1.0.0.Final.jar
jboss-jms-api_1.1_spec-1.0.0.Final.jar
jbossjts-4.16.4.Final.jar
jboss-logging-3.1.0.GA.jar
jboss-logmanager-1.2.2.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jboss-transaction-spi-7.0.0.Final.jar
jgroups-3.2.5.Final.jar
jnpserver-5.0.3.GA.jar
netty-3.6.2.Final.jarhornetq-commons-2.3.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/hornetq-core-client-2.3.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/hornetq-jms-client-2.3.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/hornetq-jms-server-2.3.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/hornetq-journal-2.3.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/hornetq-ra-2.3.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/hornetq-rar-2.3.0.Final-sources.jar
/home/evilla/data/products/tomEE/hornetqlib/hornetq-server-2.3.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/jboss-common-core-2.2.14.GA.jar
/home/evilla/data/products/tomEE/hornetqlib/jboss-connector-api_1.5_spec-1.0.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/jboss-jms-api_1.1_spec-1.0.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/jbossjts-4.16.4.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/jboss-logging-3.1.0.GA.jar
/home/evilla/data/products/tomEE/hornetqlib/jboss-logmanager-1.2.2.GA.jar
/home/evilla/data/products/tomEE/hornetqlib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/jboss-transaction-spi-7.0.0.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/jgroups-3.2.5.Final.jar
/home/evilla/data/products/tomEE/hornetqlib/jnpserver-5.0.3.GA.jar
/home/evilla/data/products/tomEE/hornetqlib/netty-3.6.2.Final.jar

*4 - We changed our tomee.xml in this way:*

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

	<Container id="SmsJmsMdbContainer" type="MESSAGE"
provider="org.hornetq.ra#HornetQ MDB Container">
		ResourceAdapter SmsJmsResourceAdapter
		MessageListenerInterface javax.jms.MessageListener
		ActivationSpecClass org.hornetq.ra.inflow.HornetQActivationSpec
		InstanceLimit 10
	</Container>
	
	<Resource id="SmsJmsResourceAdapter" type="HornetQResourceAdapter"
provider="org.hornetq.ra#HornetQ JMS Resource Adapter">
		DiscoveryAddress 127.0.0.1
		DiscoveryPort 5445
	</Resource>
	
	<Resource id="SmsQueue" provider="org.hornetq.ra#Default Queue">
	</Resource>
	
	<Connector id="SmsJmsConnectionFactory" type="javax.jms.ConnectionFactory"
provider="org.hornetq.ra#HornetQ JMS Connection Factory">
		ResourceAdapter SmsJmsResourceAdapter
		TransactionSupport xa
		PoolMaxSize 10
		PoolMinSize 0
		ConnectionMaxWaitMilliseconds 5000
		ConnectionMaxIdleMinutes 15
	</Connector>	

</tomee>

*RESULT:*
When we start the application server, we have the following error:

INFO: HQ151001: Attempting to reconnect
org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@5ab3f4a1
destination=SmsQueue destinationType=javax.jms.Queue ack=Auto-acknowledge
durable=false clientID=null user=null maxSession=15)
Aug 21, 2013 10:11:32 AM org.hornetq.ra.inflow.HornetQActivation
handleFailure
ERROR: HQ154003: Unable to reconnect
org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@5ab3f4a1
destination=SmsQueue destinationType=javax.jms.Queue ack=Auto-acknowledge
durable=false clientID=null user=null maxSession=15)
HornetQException[errorType=INTERNAL_ERROR message=HQ119004: Failed to
initialise session factory]
	at
org.hornetq.core.client.impl.ServerLocatorImpl.initialise(ServerLocatorImpl.java:393)
	at
org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:776)
	at
org.hornetq.ra.inflow.HornetQActivation.setup(HornetQActivation.java:312)
	at
org.hornetq.ra.inflow.HornetQActivation.handleFailure(HornetQActivation.java:651)
	at
org.hornetq.ra.inflow.HornetQActivation$SetupActivation.run(HornetQActivation.java:706)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:366)
	at
org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: java.net.SocketException: Not a multicast address
	at java.net.MulticastSocket.joinGroup(MulticastSocket.java:306)
	at
org.hornetq.api.core.UDPBroadcastGroupConfiguration$UDPBroadcastEndpoint.openClient(UDPBroadcastGroupConfiguration.java:215)
	at org.hornetq.core.cluster.DiscoveryGroup.start(DiscoveryGroup.java:108)
	at
org.hornetq.core.client.impl.ServerLocatorImpl.initialise(ServerLocatorImpl.java:387)
	... 9 more

It seems an error due to the DeliveryAddress specified in tomee.xml during
SmsJmsResourceAdapter resource definition... Is there a way to specify a
"static" address? I mean an addresss like 127.0.0.1 where we install our
standalone HornetQ instance... Or we are wrong with something else?

Thank you to anyone who could reply!
Best regards,
Emanuele.



--
View this message in context: http://openejb.979440.n4.nabble.com/TomEE-HornetQ-standalone-tp4664751.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message