I am trying to configure ActiveMQ under TomEE.
Running into all sorts of problems.
TomEE is run from within Eclipse (via Server configuration).
1) Embedded ActiveMQ broker wouldn't start
Following online documentation and examples I configured MQ the following
way:
tomee.xml:
<Resource id="SboxResourceAdapter" type="ActiveMQResourceAdapter">
BrokerXmlConfig=broker:(tcp://localhost:61616)?persistent=false
ServerUrl=tcp://localhost:61616
</Resource>
<Resource id="SboxConnectionFactory" type="javax.jms.ConnectionFactory">
ResourceAdapter = SboxResourceAdapter
</Resource>
<Resource id="testQueue" type="javax.jms.Queue"/>
TomEE startup log (displayed to console) has this - the part relevant to its
attempt to create the resoource "SboxResourceAdapter":
INFO: Creating Resource(id=SboxResourceAdapter)
Oct 16, 2012 12:25:05 PM org.apache.activemq.ra.ActiveMQResourceAdapter$1
run
WARNING: Could not start up embeded ActiveMQ Broker
'amq5factory:broker:(tcp://localhost:61616)?persistent=false': Unknown
datasource Default Unmanaged JDBC Database
- why is it complaining about datasource, and how do I address that?
- is there any other possible reason it wouldn't start?
- what is correct syntax for BrokerXmlConfig URI? How do I add more
properties to it - e.g. useJmx=false?
2) all other subsequent problems when I try to connect to
"SboxConnectionFactory" from Java - I suspect it has to do with the fact
that the broker it is configured to use didn't start.
3) problems trying to connect to JMS via "ConnectionFactory" (since I'm not
configuring it, but it is possible to look it up - I assume it is created by
TomEE by default?)
- why am I seeing exceptions?
- what is broken?
- what do I do to fix that?
In code below it is the conn.start() that fails, but it can be pretty much
anything: I tried conn.createSession() with same effect.
Code:
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
env.put(Context.PROVIDER_URL, "tcp://localhost:61616");
env.put(Context.SECURITY_PRINCIPAL, "guest");
env.put(Context.SECURITY_CREDENTIALS, "pass");
Context context = new InitialContext(env);
System.out.println(context.getEnvironment());
System.out.println("looking up "+cfName);
ConnectionFactory cf = (ConnectionFactory)
context.lookup("ConnectionFactory");
System.out.println("cf="+cf);
System.out.println("creating connection...");
Connection conn = cf.createConnection("guest", "pass");
System.out.println("conn="+conn);
System.out.println("starting connection...");
conn.start();
Output:
{java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory,
java.naming.provider.url=tcp://localhost:61616,
java.naming.security.principal=guest, java.naming.security.credentials=pass}
looking up ConnectionFactory
cf=org.apache.activemq.ActiveMQConnectionFactory@34005e1
creating connection...
<COMMENT: in subsequent line I put "XXXXXXX" instead of the actual
value - it seems to be using my actual login name and appends some numbers;
I don't want to disclose that info>
conn=ActiveMQConnection {id=ID:XXXXXX:1,clientId=null,started=false}
starting connection...
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:1306)
at
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1392)
at
org.apache.activemq.ActiveMQConnection.start(ActiveMQConnection.java:504)
at sandbox.TestJMS.main(TestJMS.java:40)
Caused by: java.io.IOException: Wire format negotiation timeout: peer did
not send his wire format.
at
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:98)
at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1284)
... 3 more
Thanks in advance!
--
View this message in context:
http://openejb.979440.n4.nabble.com/Problem-starting-ActiveMQ-broker-using-TomEE-tp4658076.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.