1 Reply Latest reply on Dec 17, 2012 9:05 PM by Clebert Suconic

    Problems connecting to a standalone JMS Server

    Hauke Gulich Newbie

      Hello everyone,

       

      I started my own EmbeddedJMS standalone JMS Server and created a JMS Topic.

      My second application needs to connect to this server but this works only on the same machine and as long

      as I connect to "localhost". As soon as I change the IP address to the local IP address or even run the

      server on a different machine, I can't connect anymore.

       

      I guess the problem might be the binding. On jboss I know how to set up the binding, but how can I do

      that on a standalone server?

       

      Here is my code snippet

       

       

      {code}

        // Server konfigurieren

                       Configuration configuration = new ConfigurationImpl();

                       configuration.setPersistenceEnabled(false);

                       configuration.setSecurityEnabled(false);

                       configuration.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));

       

                       TransportConfiguration connectorConfig = new TransportConfiguration(NettyConnectorFactory.class.getName());        

                       configuration.getConnectorConfigurations().put("connector", connectorConfig);

              

                       // JMS Konfiguration

                       JMSConfiguration jmsConfig = new JMSConfigurationImpl();

              

                       // JMS Factory konfigurieren

                       ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl("cf", false, new ArrayList<String>(){{add("connector");}}, "/cf");

                       jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);

                                                

                       // Queues und Topics anlegen

                       for (String queueName : queueList) {

                           logger.info("Neue Queue wird deployed ["+queueName+"]");

                           JMSQueueConfiguration queue = new JMSQueueConfigurationImpl(queueName, null, false, "/queue/"+queueName);

                           jmsConfig.getQueueConfigurations().add(queue);

                        }

                      

                       for (String topicName : topicList) {

                           logger.info("Neues Topic wird deployed ["+topicName+"]");

                           TopicConfiguration topicConfiguration = new TopicConfigurationImpl(topicName, "/topic/"+topicName);

                           jmsConfig.getTopicConfigurations().add(topicConfiguration);

                       }

                                       

                       // Starte JMS Server auf Basis des HornetQ Server mit den JMS Konfigurationen

                       jmsServer = new EmbeddedJMS();

                       jmsServer.setConfiguration(configuration);

                       jmsServer.setJmsConfiguration(jmsConfig);

                    

                      

                      

                       jmsServer.start();

      {code}

       

      Sorry for the german comments.

       

       

      Greetings,

      Hauke