activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shamilds <shami...@gmail.com>
Subject Enterprise application throws unknown protocol tcp exception
Date Fri, 03 Feb 2012 18:03:33 GMT
Hi all,

Im new to ActiveMQ and glassfish configurations. Im trying to run ActiveMQ
as a separate application and listening to tcp://0.0.0.0:61616 connections.
The use an ejb application to connect to tcp://0.0.0.0:61616 url and send
messages to myTopic.

First i started the activeMQ. it starts successfully, then login to admin
panel and created a topic call myTopic. The im trying to send messages to
this topic using an ejb. Here is my ejb code:


Properties props = new Properties();           
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL,"tcp://0.0.0.0:61616");
javax.naming.Context ctx = new InitialContext(props);

javax.jms.TopicConnectionFactory factory =
(javax.jms.TopicConnectionFactory)ctx.lookup("ConnectionFactory");
javax.jms.TopicConnection conn = factory.createTopicConnection();
javax.jms.Topic mytopic =
(javax.jms.Topic)ctx.lookup("ActiveMQ.Test.VRMTopic");
javax.jms.TopicSession session =
conn.createTopicSession(false,TopicSession.AUTO_ACKNOWLEDGE);

producer = session.createProducer(mytopic);
TextMessage mesg = session.createTextMessage("Text message!");
producer.send(mesg);

When i try to call this function it throws me following exception:

Caused by: javax.naming.ConfigurationException: Invalid URL:
tcp://0.0.0.0:61616 [Root exception is java.net.MalformedURLException:
Unknown protocol: tcp]
        at com.sun.jndi.cosnaming.CNCtx.getStringifiedIor(CNCtx.java:436)
        at
com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:227)
        at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:87)
        at
com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.java:32)


I tried this one with jndi.properties file as well. but same result.
Im using glassfish 3.0.1 as ejb container
java 1.6
ActiveMQ 5.4.3

can anybody help me..
many thanks

--
View this message in context: http://activemq.2283324.n4.nabble.com/Enterprise-application-throws-unknown-protocol-tcp-exception-tp4355337p4355337.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message