7 Replies Latest reply on Aug 11, 2010 1:48 PM by caravan johns

    jboss-6.*-M3 how to configure hornetq

    caravan johns Newbie

      I am a newbie,and I've downloaded jboss-6.8-M3 version,could anybody tell me how to configure hornetq with this?

      and what else should i do if I wanna just run a standalone hornetq server?

       

      ps:my project is is spring based, and I have plenty of linux servers and sun servers to use

           thanks regards

        • 1. Re: jboss-6.*-M3 how to configure hornetq
          jaikiran pai Master

          I would recommend you downlaod JBoss AS 6.0.0.M4, which is the latest one. Both 6.0.0.M3 and 6.0.0.M4 have HornetQ integrated in them by default. So you don't have to do anything additional for HornetQ support.

          • 2. Re: jboss-6.*-M3 how to configure hornetq
            caravan johns Newbie

            I've set up jboss6.*M3, and I've logged into admin console successfully...when my program try to connect hornetq at 5455, it failed....and I found default hostname for port 5455 is 0.0.0.0,..it is giving me error when i try to change it to something else....what should I do ?

            • 3. Re: jboss-6.*-M3 how to configure hornetq
              caravan johns Newbie

              I am testing jboss on my laptop...and I am having a new exception now....

               

               

               

              errorCode=108 message=Server and client versions incompatible

               

               

              could anybody help me out with this? thanks regards

              • 4. Re: jboss-6.*-M3 how to configure hornetq
                jaikiran pai Master

                You'll have to tell us what exactly you are trying and how? Are you following any documentation? If yes, which one?

                 

                P.S: I again recommend that you move to 6.0.0.M4.

                • 5. Re: jboss-6.*-M3 how to configure hornetq
                  caravan johns Newbie

                  yes , i am using jbossm4 right now...i've added queue through admin console...

                  and in my application I am getting error

                   

                  here is my my client-jndi.properties file

                   

                   

                   

                  java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                  java.naming.provider.url=jnp://localhost:1099
                  java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces

                   

                   

                   

                   

                  there is my test code

                   

                   

                   

                   

                  package com.genesis.hornetq.test;

                  import java.io.File;

                  import java.io.FileInputStream;

                  import java.io.InputStream;

                  import java.util.Properties;

                   

                  import javax.jms.Connection;

                  import javax.jms.ConnectionFactory;

                  import javax.jms.MessageConsumer;

                  import javax.jms.MessageProducer;

                  import javax.jms.Queue;

                  import javax.jms.Session;

                  import javax.jms.TextMessage;

                  import javax.naming.InitialContext;

                   

                  public class ConsoleClient {

                   

                       public static void main(final String[] args) throws Exception {

                            try {

                                 runExample();

                            } catch (Exception e) {

                                 e.printStackTrace();

                            }

                       }

                   

                       private static InitialContext getContext(final int serverId)

                                 throws Exception {

                            String jndiFilename = "client-jndi.properties";

                            File jndiFile = new File(jndiFilename);

                            System.out.println(jndiFile.getAbsolutePath());

                  //          HornetQExample.log.info("using " + jndiFile + " for jndi");

                            Properties props = new Properties();

                            InputStream inStream = null;

                            try {

                                 inStream = ConsoleClient.class.getResourceAsStream(jndiFilename); // new FileInputStream(jndiFile);

                                 props.load(inStream);

                            } finally {

                                 if (inStream != null) {

                                      inStream.close();

                                 }

                            }

                            return new InitialContext(props);

                       }

                   

                       public static Boolean runExample() throws Exception {

                   

                            Connection connection = null;

                            InitialContext initialContext = null;

                            try {

                                 // Step 1. Create an initial context to perform the JNDI lookup.

                                 initialContext = getContext(0);

                   

                                 // Step 2. Perfom a lookup on the queue

                                 Queue queue = (Queue) initialContext.lookup("/queue/testq");

                                 //Queue queue = (Queue) initialContext.lookup("/queue/sb/TestQueue");

                   

                   

                                 // Step 3. Perform a lookup on the Connection Factory

                                 ConnectionFactory cf = (ConnectionFactory) initialContext

                                           .lookup("/ConnectionFactory");

                   

                                 // Step 4.Create a JMS Connection

                                 connection = cf.createConnection();

                   

                                 // Step 5. Create a JMS Session

                                 Session session = connection.createSession(false,

                                           Session.AUTO_ACKNOWLEDGE);

                   

                                 // Step 6. Create a JMS Message Producer

                                 MessageProducer producer = session.createProducer(queue);

                   

                                 // Step 7. Create a Text Message

                                 TextMessage message = session

                                           .createTextMessage("This is a text message");

                   

                                 System.out.println("Sent message: " + message.getText());

                   

                                 // Step 8. Send the Message

                                 producer.send(message);

                   

                                 // Step 9. Create a JMS Message Consumer

                                 MessageConsumer messageConsumer = session.createConsumer(queue);

                   

                                 // Step 10. Start the Connection

                                 connection.start();

                   

                                 // Step 11. Receive the message

                                 TextMessage messageReceived = (TextMessage) messageConsumer

                                           .receive(5000);

                   

                                 System.out

                                           .println("Received message: " + messageReceived.getText());

                   

                                 return true;

                            } finally {

                                 // Step 12. Be sure to close our JMS resources!

                                 if (initialContext != null) {

                                      initialContext.close();

                                 }

                                 if (connection != null) {

                                      connection.close();

                                 }

                            }

                       }

                  }

                   

                   

                   

                  here is the exception I am getting

                   

                   

                  javax.jms.JMSException: Server and client versions incompatible

                       at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:287)

                       at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:410)

                       at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1123)

                       at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:849)

                       at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:565)

                       at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:624)

                       at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:116)

                       at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:111)

                       at com.genesis.hornetq.test.ConsoleClient.runExample(ConsoleClient.java:63)

                       at com.genesis.hornetq.test.ConsoleClient.main(ConsoleClient.java:20)

                  Caused by: HornetQException[errorCode=108 message=Server and client versions incompatible]

                       ... 10 more

                   

                   

                  if i change queue name to something i dont have in admin console, I am getting queue not bound exception....

                   

                  how can I get hornetq working ? thanks regards

                  • 6. Re: jboss-6.*-M3 how to configure hornetq
                    Clebert Suconic Master

                    First things first...

                     

                    It's a bit vague to ask "how can I get hornetQ working"

                     

                     

                    first: your client libraries don't match the server's version.. as you can see by the exception you got... update the client libraries accordingly to what you have on the server. (/jboss/lib)

                     

                     

                    Fix your libraries first. Then lets see how it goes.. then you will be able to ask specific questions.

                    • 7. Re: jboss-6.*-M3 how to configure hornetq
                      caravan johns Newbie

                      thanks for the reply,I've solved my proble by changing lib jars...yeah, that is awesome thanks a lot