8 Replies Latest reply on Mar 4, 2011 3:53 AM by sergiu_pienar

    Standalone HornetQ

    georgenowin

      HI,

       

      Is there any example on how to configure HornetQ to work as a standalone server?

       

      Thx.

        • 1. Standalone HornetQ
          gmkumar2005
          • 2. Re: Standalone HornetQ
            georgenowin

            I get this when trying to use HornetQ as a standalone server.The same config works with HornetQ embedded in JBoss 5.1.0.GA.

             

            10:33:04,529 INFO  [EJBContainer] STARTED EJB: com.application.business.imaging.TestMDB ejbName: TestMDB

            10:33:04,615 ERROR [AbstractKernelController] Error installing to Start: name=jboss.j2ee:ear=application.ear,jar=app.jar,name=TestMDB,service=EJB3 state=Create

            org.jboss.deployers.spi.DeploymentException: Unable to create activation spec ra=jboss.jca:service=RARDeployment,name='hornetq-ra.rar' messaging-type=javax.jms.MessageListener properties={destinationType=org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData@96f19068{destinationType}, acknowledgeMode=org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData@6969e25f{acknowledgeMode}, user=org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData@36ebcb{user}, password=org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData@4889ba9b{password}, destination=org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData@aac6440e{destination}, DLQMaxResent=org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData@dcd76c06{DLQMaxResent}}

             

            Caused by: javax.management.InstanceNotFoundException: jboss.jca:service=RARDeployment,name='hornetq-ra.rar' is not registered.

             

            What am I doing wrong?

             

            Thx.

            • 3. Re: Standalone HornetQ
              ataylor

              thats an EJB exception you are getting so i'm not sure how a standalone HornetQ instance can create this exception. take a look at one of the many examples that ship with the distro

              • 4. Standalone HornetQ
                gmkumar2005

                please post hornetq-configuration.xml

                 

                --Kiran.Kumar

                • 5. Re: Standalone HornetQ
                  sergiu_pienar

                  This is my hornetq-config.xml

                   

                  <!--

                    ~ 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.

                    -->

                   

                  <configuration xmlns="urn:hornetq"

                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                 xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

                   

                     <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name>

                   

                     <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>

                   

                     <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>

                   

                     <journal-file-size>10485760</journal-file-size>

                     <journal-min-files>50</journal-min-files>

                   

                     <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>

                   

                     <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>

                   

                     <connectors>

                        <connector name="netty">

                           <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                        </connector>

                      </connectors>

                   

                     <acceptors>  

                        <acceptor name="netty">

                           <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                           <param key="port"  value="${hornetq.remoting.netty.port:5446}"/>

                        </acceptor>

                     </acceptors>

                   

                     <security-settings>

                   

                        <security-setting match="#">

                           <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>60000</redelivery-delay>        

                           <max-delivery-attempts>10</max-delivery-attempts>

                           <max-size-bytes>1073741824</max-size-bytes> 

                           <message-counter-history-day-limit>10</message-counter-history-day-limit>

                           <address-full-policy>BLOCK</address-full-policy>

                        </address-setting>

                     </address-settings>

                   

                  </configuration>

                  • 6. Re: Standalone HornetQ
                    ataylor

                    you will need to post your ra.xml and jms-ds.xml

                    • 7. Re: Standalone HornetQ
                      sergiu_pienar

                      <connection-factories>

                         <!--

                          JMS Stuff

                         -->

                       

                         <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">

                            <attribute name="ProviderName">DefaultJMSProvider</attribute>

                            <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

                            <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>

                            <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>

                            <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>

                         </mbean>

                       

                       

                       

                         <!--

                          JMS XA Resource adapter, use this to get transacted JMS in beans

                         -->

                         <tx-connection-factory>

                            <jndi-name>JmsXA</jndi-name>

                            <xa-transaction/>

                            <rar-name>hornetq-ra.rar</rar-name>

                            <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>

                            <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>

                            <config-property name="ConnectorClassName" type="java.lang.String">org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property>

                            <config-property name="ConnectionParameters" type="java.lang.String">host=192.168.224.5;port=5445</config-property>

                            <max-pool-size>20</max-pool-size>

                            <security-domain-and-application>JmsXARealm</security-domain-and-application>

                         </tx-connection-factory>

                       

                      </connection-factories>

                       

                      and ra.xml :

                       

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

                       

                      <!--

                        ~ 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.

                        -->

                       

                      <!-- This file will be installed by the example mdb-remote/build.xml, deploy target.

                           This is an example of how you could change the default configuration of a resource adapter

                      -->

                       

                      <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 Alternate Configuration</description>

                         <display-name>HornetQ 2.0 Resource Adapter Alternate Configuration</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</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;</description>

                               <config-property-name>ConnectionParameters</config-property-name>

                               <config-property-type>java.lang.String</config-property-type>

                               <config-property-value>host=192.168.224.5;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>

                       

                      Using these settings I can publish messages to the hornetQ server using a simple JMS Client but when I'm using my app deployed in JBoss I can't.(javax.naming.NameNotFoundException). I suspect it's because I'm doing something wrong and the ConnectionFactory doesn't get bound in the GlobalJNDI namespace.

                      • 8. Standalone HornetQ
                        sergiu_pienar

                        Fixed.

                         

                        Thx everybody for your help.