You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Justin Bertram (JIRA)" <ji...@apache.org> on 2017/05/15 16:27:04 UTC
[jira] [Updated] (ARTEMIS-1164) NameNotFoundException when using
java.naming.provider.url to set url via jndi
[ https://issues.apache.org/jira/browse/ARTEMIS-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Bertram updated ARTEMIS-1164:
------------------------------------
Description:
It should be possible to create a connection factory via JNDI simply defining the initial context factory and provider url.
{noformat}
java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=tcp://localhost:5445?type=CF
{noformat}
As per samples in docs.
https://activemq.apache.org/artemis/docs/2.0.0/using-jms.html
This does not seems to be the case, see below test to prove this.
{code:java}
@Test
public void providerURLTest() throws NamingException {
String url = "(tcp://somehost:62616,tcp://somehost:62616)?ha=true";
Properties props = new Properties();
props.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
props.setProperty(javax.naming.Context.PROVIDER_URL, url);
InitialContext context = new InitialContext(props);
ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup("ConnectionFactory");
}
{code}
It seems and mandatory param (duplicating the required and standard java.naming.provider.url),
{noformat}
props.setProperty("connectionFactory.ConnectionFactory",url);
{noformat}
{code:java}
@Test
public void connectionFactoryProperty() throws NamingException {
String url = "(tcp://somehost:62616,tcp://somehost:62616)?ha=true";
Properties props = new Properties();
props.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
props.setProperty(javax.naming.Context.PROVIDER_URL, url);
props.setProperty("connectionFactory.ConnectionFactory",url);
InitialContext context = new InitialContext(props);
ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup("ConnectionFactory");
}
{code}
Either:
A) the documentation samples need to be changed
OR
B) The ActiveMQInitialContextFactory should default register connection factory created using java.naming.provider.url as ConnectionFactory.
I would propose the latter, as this seems to be the way in Active MQ 5 and some other technologies.
was:
It should be possible to create a connection factory via JNDI simply defining the initial context factory and provider url.
java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=tcp://localhost:5445?type=CF
As per samples in docs.
https://activemq.apache.org/artemis/docs/2.0.0/using-jms.html
This does not seems to be the case, see below test to prove this.
@Test
public void providerURLTest() throws NamingException {
String url = "(tcp://somehost:62616,tcp://somehost:62616)?ha=true";
Properties props = new Properties();
props.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
props.setProperty(javax.naming.Context.PROVIDER_URL, url);
InitialContext context = new InitialContext(props);
ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup("ConnectionFactory");
}
It seems and mandatory param (duplicating the required and standard java.naming.provider.url),
props.setProperty("connectionFactory.ConnectionFactory",url);
"
@Test
public void connectionFactoryProperty() throws NamingException {
String url = "(tcp://somehost:62616,tcp://somehost:62616)?ha=true";
Properties props = new Properties();
props.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
props.setProperty(javax.naming.Context.PROVIDER_URL, url);
props.setProperty("connectionFactory.ConnectionFactory",url);
InitialContext context = new InitialContext(props);
ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup("ConnectionFactory");
}
"
Either:
A) the documentation samples need to be changed
OR
B) The ActiveMQInitialContextFactory should default register connection factory created using java.naming.provider.url as ConnectionFactory.
I would propose the latter, as this seems to be the way in Active MQ 5 and some other technologies.
> NameNotFoundException when using java.naming.provider.url to set url via jndi
> ------------------------------------------------------------------------------
>
> Key: ARTEMIS-1164
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1164
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Michael Andre Pearce
>
> It should be possible to create a connection factory via JNDI simply defining the initial context factory and provider url.
> {noformat}
> java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
> java.naming.provider.url=tcp://localhost:5445?type=CF
> {noformat}
> As per samples in docs.
> https://activemq.apache.org/artemis/docs/2.0.0/using-jms.html
> This does not seems to be the case, see below test to prove this.
> {code:java}
> @Test
> public void providerURLTest() throws NamingException {
> String url = "(tcp://somehost:62616,tcp://somehost:62616)?ha=true";
>
> Properties props = new Properties();
> props.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
> props.setProperty(javax.naming.Context.PROVIDER_URL, url);
> InitialContext context = new InitialContext(props);
> ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup("ConnectionFactory");
> }
> {code}
> It seems and mandatory param (duplicating the required and standard java.naming.provider.url),
> {noformat}
> props.setProperty("connectionFactory.ConnectionFactory",url);
> {noformat}
> {code:java}
> @Test
> public void connectionFactoryProperty() throws NamingException {
> String url = "(tcp://somehost:62616,tcp://somehost:62616)?ha=true";
> Properties props = new Properties();
> props.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getName());
> props.setProperty(javax.naming.Context.PROVIDER_URL, url);
> props.setProperty("connectionFactory.ConnectionFactory",url);
> InitialContext context = new InitialContext(props);
> ConnectionFactory connectionFactory = (ConnectionFactory)context.lookup("ConnectionFactory");
> }
> {code}
> Either:
> A) the documentation samples need to be changed
> OR
> B) The ActiveMQInitialContextFactory should default register connection factory created using java.naming.provider.url as ConnectionFactory.
> I would propose the latter, as this seems to be the way in Active MQ 5 and some other technologies.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)