You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by zappee <ar...@gmail.com> on 2016/01/24 20:08:55 UTC

activemq 5.13 + glassfish + remote client

Hi,

It would be great if you help me. I am new in ActiveMQ so I do not have too
much experience with it.

I followed the documentation and I have a installed activemq with glassfish
4.1.
Everything seems fine but I get a strange exception when I send a text
message to the queue:

Could not start up embeded ActiveMQ Broker 'broker:(tcp://0.0.0.0:61616)':
Failed to bind to server socket: tcp://0.0.0.0:61616 due to:
java.net.BindException: Address already in use

Starting ActiveMQ Broker | X{routeId}  |  | Reason for: Failed to bind to
server socket: tcp://0.0.0.0:61616 due to: java.net.BindException: Address
already in use
java.io.IOException: Failed to bind to server socket: tcp://0.0.0.0:61616
due to: java.net.BindException: Address already in use 

I do not understand it. I have just created a client not a server. What is
that embeded broker? I just want to send a message to the queue as a client
with my simple java code:


    public static void main(String[] args) throws Exception {
        Properties prop = new Properties();
        //prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.SerialInitContextFactory");
        //prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
        //prop.setProperty(Context.URL_PKG_PREFIXES,
"com.sun.enterprise.naming");
        prop.setProperty("org.omg.CORBA.ORBInitialPort", SERVER_PORT);
        prop.setProperty("org.omg.CORBA.ORBInitialHost", SERVER_HOST);

        InitialContext initialContext = new InitialContext(prop);
        QueueConnectionFactory connectionFactory = (QueueConnectionFactory)
initialContext.lookup(QUEUE_CONNECTION_FACTORY);

        QueueConnection queueConnection =
connectionFactory.createQueueConnection();

        QueueSession queueSession =
queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

        Queue queue = (Queue) initialContext.lookup(QUEUE);
        QueueSender sender = queueSession.createSender(queue);

        Message message = queueSession.createTextMessage("hello...");
        sender.send(message);

        queueSession.close();
        queueConnection.close();
        initialContext.close();

        System.out.println("-- end --");
    }

What is wrong with it?



--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq-5-13-glassfish-remote-client-tp4706356.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: activemq 5.13 + glassfish + remote client

Posted by zappee <ar...@gmail.com>.
One more thing:
I think this exception may has a connection with the "Resource Adapter
Config" section on the GlassFish console.

The value of the BrokerXmlConfig property is "broker:(tcp://0.0.0.0:61616)".
Without this parameter my active mq connection pool does not work.




--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq-5-13-glassfish-remote-client-tp4706356p4706357.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.