activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cristisor <cristisor...@yahoo.com>
Subject Re: Basic ActiveMQ example help
Date Wed, 17 Oct 2012 07:16:57 GMT
Good morning,

In tomee.xml I have the following resources configured:

        <Resource id="JMSAdapter" type="ActiveMQResourceAdapter">
		BrokerXmlConfig = (tcp://localhost:61616)?useJmx=true;
	</Resource>

	<Resource id="JMSConnectionFactory" type="javax.jms.ConnectionFactory">
		ResourceAdapter = JMSAdapter
	</Resource>
	
	<Resource id="JMSQueue" type="javax.jms.Queue">
		destination = Queue1
	</Resource>
	
	<Resource id="Foo" type="javax.jms.Topic">
		destination = Topic1
	</Resource>

I also deployed the activemq web-console and I access it at:
http://localhost:8080/activemq-web-console-5.7.0/index.jsp
<http://localhost:8080/activemq-web-console-5.7.0/index.jsp>   
but the Queues, Topics and Connections tabs don't show any resource.

I suppose that I can only get RemoteInitialContextFactory and not
ActiveMQInitialContextFactory because the resources are deployed in Tomee+
and I can only have access to the server context, right?

Here is my code, please tell me if it's the correct approach:
	final Hashtable<String, String> ctxProps = new Hashtable<String,
String>(4);
	ctxProps.put("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
	ctxProps.put("java.naming.provider.url",
"http://localhost:8080/tomee/ejb");
	ctxProps.put("java.naming.security.principal", "tomee");
	ctxProps.put("java.naming.security.credentials", "tomee");
	InitialContext ctx = new InitialContext(ctxProps);
        ConnectionFactory cf = (ConnectionFactory)
context.lookup("JMSConnectionFactory");

This approach doesn't work:
	final Hashtable<String, String> ctxProps = new Hashtable<String,
String>(2);
	ctxProps.put("java.naming.factory.initial",
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
	ctxProps.put("java.naming.provider.url", "http://localhost:61616");
	InitialContext ctx = new InitialContext(ctxProps);
        ConnectionFactory cf = (ConnectionFactory)
context.lookup("JMSConnectionFactory");

Is it because the resources are located in tomee.xml?
ActiveMQInitialContextFactory doesn't exist at all in the tomee container, I
can't use it even from an application deployed on tomee?

One last thing, why do I need the parameter below in order to get the
ActiveMQConnectionFactory?
-DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616

Thank you very much for your help.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Basic-ActiveMQ-example-help-tp4657851p4657877.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message