Hello all!

I have the activemq.xml file, listed below:

<beans>
    <bean
        
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
    <broker brokerName="broker0" xmlns="http://activemq.org/config/1.0";>
        <managementContext>
            <managementContext connectorPort="1599"
                jmxDomainName="org.apache.activemq"/>
        </managementContext>
        <!--
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://localhost:1235" />
        </transportConnectors>
        -->
    </broker>
    <jetty xmlns="http://mortbay.com/schemas/jetty/1.0";>
        <connectors>
            <nioConnector port="8161" />
        </connectors>
        <handlers>
            <webAppContext contextPath="/fileserver"
                resourceBase="webapps/" logUrlOnStart="true" />
        </handlers>
    </jetty>
</beans>

When transportConnectors section was uncommented, everything is working fine -
the broker is listening for connections at port 1235.

Due to flexibility requests we need to allow the application to be configured
by passing the broker connection url through the command line, so we decided
to comment out the transportConnectors section and use addConnection() method
in the broker as listed below:

    final BrokerService broker = BrokerFactory.createBroker(new URI(
                        "xbean:activemq.xml"));
    System.out.format("Using transport connector '%1$s'\n", connectorUrl);
    broker.addConnector(connectorUrl);
    broker.start();

However this doesn't work well - while there is something listening on port
1235, the remote clients of the brokers are getting such exception during
connection:

Exception in thread "main" javax.jms.JMSException: Wire format negotiation 
timeout: peer did not send his wire format.
        at 
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
        at 
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1206)
        at 
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1289)
        at 
org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:456)

With replacing the code line 
    final BrokerService broker = BrokerFactory.createBroker(new URI(
                        "xbean:activemq.xml"));
with

final BrokerService broker = new BrokerService();

everything works fine and connections are negitiated and accepted by broker.

the question is - what is the correct way to add the connection listeners to the
BrokerService, configured with bean definition like I pasted above?

Thank you in advance!

-- 
Eugene N Dzhurinsky

Attachment: pgp0zTPnBo8Qm.pgp
Description: PGP signature

Reply via email to