I am following the instruction on
http://devzone.logicblaze.com/site/integrating-apache-activemq-with-jboss.html
to integrate jboss4.0.5/activemq4.0.
I have a problem with looking up connection factory with remote jboss jndi
access.
I have this in –ds.xml
<tx-connection-factory>
<jndi-name>testing/TopicConnectionFactory</jndi-name>
<use-java-context>false</use-java-context>
<xa-transaction/>
<track-connection-by-tx/>
<rar-name>activemq-ra.rar</rar-name>
<connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
<ServerUrl>vm://localhost</ServerUrl>
<min-pool-size>1</min-pool-size>
<max-pool-size>200</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>3</idle-timeout-minutes>
</tx-connection-factory>
I tried to look up the connection factory with code.
try {
Properties env2 = new Properties();
env2.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env2.put(Context.PROVIDER_URL, "jnp://localhost:1099");
InitialContext jndiContext = new InitialContext(env2);
// print the binding info
NamingEnumeration<NameClassPair> namingEnum =
jndiContext.list("testing");
while (namingEnum.hasMore()) {
NameClassPair nameClassPair = namingEnum.next();
System.out.println("Name: " + nameClassPair.getName() + " ,
Class: " + nameClassPair.getClassName() );
}
ref = jndiContext.lookup("testing/TopicConnectionFactory");
System.out.println("ref is null:" + (ref==null));
TopicConnectionFactory tFactory = (TopicConnectionFactory)
PortableRemoteObject
.narrow(ref, TopicConnectionFactory.class);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
I got the following print out:
Name: JVTEventTopic , Class: org.apache.activemq.command.ActiveMQTopic
Name: QueueConnectionFactory , Class:
org.apache.activemq.ra.ActiveMQConnectionFactory
Name: TopicConnectionFactory , Class:
org.apache.activemq.ra.ActiveMQConnectionFactory
Name: MessageQueue , Class: org.apache.activemq.command.ActiveMQQueue
Name: XVTEventTopic , Class: org.apache.activemq.command.ActiveMQTopic
ref is null
Note that I did NOT get any NameNotFoundException and the print out actually
shows that the binding is correct. So why would I get null when I tried to
lookup "testing/TopicConnectionFactory"?
I have the activemq-ra-4.0.2.jar file in the <jboss>/server/default/lib
directory.
And I want to configure the topic connection factory with ra.xml, so I
cannot use activemq jndi.
Thanks,
-Wallace
--
View this message in context:
http://www.nabble.com/Get-null-topic-connectionfatory-from-jboss-jndi-tf3646720s2354.html#a10185072
Sent from the ActiveMQ - User mailing list archive at Nabble.com.