Hi skoldrh,
This is some code I have used in the past (Authentication changed to
'dummy' for this example):
/**
* Attempt to get a JMS connection
* The failover option should only be used for a known good host
*
* @param host JMS host
* @param failover Make a failover connection
* @return Connection
* @throws NamingException
* @throws JMSException
*/
private static Connection getJmsConnection(final String host, final
int port, final boolean failover) throws NamingException, JMSException {
final String connectionString;
if (failover) {
connectionString =
"failover:(nio://%1$s:%2$s?soTimeout=60000&daemon=true&keepAlive=true&connectionTimeout=120000&wireFormat.tcpNoDelayEnabled=true&wireFormat.maxInactivityDuration=480000&wireFormat.maxInactivityDurationInitalDelay=120000)?timeout=15000";
} else {
connectionString =
"tcp://%1$s:%2$s?soTimeout=250&daemon=true&keepAlive=true&connectionTimeout=250&wireFormat.tcpNoDelayEnabled=true";
}
final Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
env.setProperty(Context.PROVIDER_URL,
String.format(connectionString, host, port));
env.setProperty(javax.naming.Context.SECURITY_PRINCIPAL, "dummy");
env.setProperty(javax.naming.Context.SECURITY_CREDENTIALS,
"dummy");
final InitialContext jmxc = new InitialContext(env);
final ConnectionFactory cf = (ConnectionFactory)
jmxc.lookup("ConnectionFactory");
return cf.createConnection("dummy", "dummy");
}
Andy.
On 14/10/2014 22:08, skoldrh wrote:
I missed some of the posts that showed the proper call which was as follows:
<constructor-arg value="openejb:Resource/TestDS"
After doing this and modifying the other beans likewise I got the
application up and running in TomEE.
Now I am having a problem where I have a separate application that runs in
it's own JVM that needs to call the ActiveMQ Connection Factory that I have
running in TomEE.
I use same call to make the connection to JMS that I used in TomEE
<bean id="jmsConnectionFactoryJndiName"
class="java.lang.String">
<constructor-arg value="openejb:Resource/TestJmsConnectionFactory"/>
</bean>
The error I'm getting from the other application is it is getting an Error
looking up openejb:Resource/TestJmsConnectionFactory which was due to it not
able to obtain the connection to tcp://localhost:61616.
I have in the other application as part of the start-up parameters is:
-DResource/javax.jms.ConnectionFactory=connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:61616
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/JNDI-issues-with-app-moving-from-JBoss-to-TomEE-Plus-tp4672249p4672279.html
Sent from the TomEE Dev mailing list archive at Nabble.com.
--
Andy Gumbrecht
https://twitter.com/AndyGeeDe
http://www.tomitribe.com