Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8131303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:03:34+00:00 2026-06-06T09:03:34+00:00

I wrote a little program that use activemq embedded broker. Program run on one

  • 0

I wrote a little program that use activemq embedded broker. Program run on one machine successfully but does not work another one. Both of server have sun os 10 & java 7 and also activemq 5.5.1. I mean with does not work, new BrokerService() constructor call does not return for a while (a couple of minutes). Snippet code is like below.

Thanks for advices..

public static void main(String[] args) {

    // .... 
    try {
        p.start("tcp://192.168.4.2:61616");
    } catch (MessagingException e) {
        e.printStackTrace();
    }
    // ....

}


public void start(String brokerAddress) throws MessagingException {
    try {

        System.out.println(">>> initialize 2");
        broker = new JmsBroker(brokerAddress, brokerAddress.substring(6));
        System.out.println(">>> initialize 3");
        broker.start();
        System.out.println(">>> initialize 4");


        messageProducer = new JmsProducer(brokerAddress,
                                          "MESSAGING_IF_NAME",
                                          false,
                                          5000);
        System.out.println(">>> initialize 5");

    } catch (JMSException e) {
        System.out.println(e);
    }

}


public class JmsBroker extends Thread {

private BrokerService       broker;
private Object              lock;
private static final Logger logger = LoggerFactory.getLogger(JmsBroker.class);
private String              connector;


public JmsBroker(String jmsAddress, String brokerName) throws MessagingException {
    broker = new BrokerService(); // !!!!! PROBLEM
    broker.setBrokerName(brokerName);
    broker.setUseJmx(true);
    broker.setUseLoggingForShutdownErrors(true);
    broker.setSchedulerSupport(false);
    broker.setPersistent(false);
    connector = jmsAddress;

    try {
        System.out.println(">>> s1");
        broker.addConnector(connector);
        System.out.println(">>> s2");
        broker.start(true);
        System.out.println(">>> s3");

        while (!broker.isStarted()) {
            Thread.sleep(10);
            System.out.println("BROKER NOT STARTED");
        }

        logger.info("JMS BROKER STARTED");
        System.out.println("JMS BROKER STARTED");
    } catch (InterruptedException e) {
        throw new MessagingException(e);
    } catch (Exception e) {
        throw new MessagingException(e);
    }
}

public void run() {
    try {
        lock = new Object();
        synchronized (lock) {
            lock.wait();
        }
    } catch (Exception e) {
        logger.error("", e);
    }
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:03:35+00:00Added an answer on June 6, 2026 at 9:03 am

    wrong record on etc/hosts file causes this problem. After removing problem is solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple little batch file program that I wrote but it fails
I wrote a little program that solves 49151 sudoku's within an hour for an
I wrote a little program, which is working like a ping command(i use ICMPSendEcho2),
I wrote a little program using fork to create new processes which use pipe
I need to write a little program in C that parses a string. I
I wrote a little program to do generalized caesar ciphers. I can't figure out
I wrote a nice little program. At some point, it is required to load
I wrote a little Haskell program to find the area of a triangle, primarily
I am a little curious why the program I wrote on Xcode with a
I built a little program that calculates the average of 15 numbers or less.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.