activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Western (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-4957) LDAP Network Connector does not allow port number in uri
Date Thu, 22 Jan 2015 05:59:34 GMT

    [ https://issues.apache.org/jira/browse/AMQ-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14286999#comment-14286999
] 

Matthew Western commented on AMQ-4957:
--------------------------------------

Hi Mark

Many thanks for your response.

I tried using a broker protocol scheme of static in the LDAP URI (AMQ 5.9.0) as you mentioned
in your comment and a "malformed URL" exception was logged by the broker:

2015-01-22 09:49:25,062 | INFO  | connecting... | org.apache.activemq.network.LdapNetworkConnector
| NetworkConnector Start Thread-0
2015-01-22 09:49:25,062 | ERROR | Async start of network connector: org.apache.activemq.network.LdapNetworkConnectorNC[static://ldap://172.31.67.192:389]
failed | org.apache.activemq.broker.BrokerService | NetworkConnector Start Thread-0
javax.naming.NamingException: Cannot parse url: static://ldap://172.31.67.192:389 [Root exception
is java.net.MalformedURLException: Not an LDAP URL: static://ldap://172.31.67.192:389]
	at com.sun.jndi.ldap.LdapURL.<init>(Unknown Source)
	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source)
	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source)
	at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(Unknown Source)
	at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(Unknown Source)
	at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
	at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
	at javax.naming.InitialContext.init(Unknown Source)
	at javax.naming.InitialContext.<init>(Unknown Source)
	at javax.naming.directory.InitialDirContext.<init>(Unknown Source)
	at org.apache.activemq.network.LdapNetworkConnector.start(LdapNetworkConnector.java:219)
	at org.apache.activemq.broker.BrokerService$8.run(BrokerService.java:2461)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.net.MalformedURLException: Not an LDAP URL: static://ldap://172.31.67.192:389

My LDAP configuration in the above test is:

       <networkConnectors>
            <ldapNetworkConnector uri="static://ldap://172.31.67.192:389"
                            base="dc=tmts,dc=net"
                            anonymousAuthentication="true"
                            searchFilter="(!(cn=esb1))"
                            searchScope="SUBTREE_SCOPE"
                            dynamicOnly="true"
                            networkTTL="2"
                            prefetchSize="1"
                            conduitSubscriptions="true"
                            decreaseNetworkConsumerPriority="false"
                            />       
        </networkConnectors>

Perhaps you were testing on a later version of AMQ? 

Irrespective of the above, logically if the code was written to intend the broker protocol
scheme name to be mandatory as you state then the URI form:

ldap://<ip> should also be rejected with an error by the code along with ldap://<ip>:<port>.


However, currently the form ldap://<ip> is accepted. This seems a bit odd given thrust
of your explanation.

So either way from my perspective there is a deficiency in the code such that the error checking
of the broker protocol scheme name is either not applied consistently or not applied correctly.
It does not look like just a documentation issue to me.

In my own case I was using the failover protocol in production code, so the issue did not
actually affect us - it was just something we discovered during testing of various configurations
that we thought the Apache ActiveMQ team might want to be aware of.

Many thanks for your help with this.

Matthew


> LDAP Network Connector does not allow port number in uri
> --------------------------------------------------------
>
>                 Key: AMQ-4957
>                 URL: https://issues.apache.org/jira/browse/AMQ-4957
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.9.0
>         Environment: Centos 6.4, OpenLDAP 2.4
>            Reporter: Matthew Western
>            Priority: Minor
>
> When using the LDAP discovery agent, if a non-failover URI containing a port number is
specified in the ldapNetworkConnector for example:
> <networkConnectors>
> <ldapNetworkConnector uri="ldap://172.31.67.192:389"
>                                         base="dc=tmts,dc=net"
>                                         anonymousAuthentication="true"
>                                         searchFilter="(!(cn=esb1))"
>                                         searchScope="SUBTREE_SCOPE"
>                                         dynamicOnly="true"
>                                         networkTTL="2"
>                                         prefetchSize="1"
>                                         conduitSubscriptions="true"
>                                         decreaseNetworkConsumerPriority="false"
>                                          />
> </networkConnectors>
> The following Java exception is seen in the log on startup and the broker never initialises:
> 2013-12-26 13:40:40,919 | INFO  | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@2919c2af:
startup date [Thu Dec 26 13:40:40 UTC 2013]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1
| main
> 2013-12-26 13:40:44,231 | ERROR | Failed to load: class path resource [activemq.xml],
reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined
in class path resource [activemq.xml]: Cannot create inner bean 'ldapNetworkConnector#4e2cb9f0'
of type [org.apache.activemq.network.LdapNetworkConnector] while setting bean property 'networkConnectors'
with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'ldapNetworkConnector#4e2cb9f0' defined in class path resource
[activemq.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property
'uri' threw exception; nested exception is java.net.URISyntaxException: Illegal character
in scheme name at index 0: 172.31.67.192:389 | org.apache.activemq.xbean.XBeanBrokerFactory
| main
> If the URI is changed to remove the port number the broker works fine. If the URI containing
a port number is used in a failover transport specification, the broker also works fine.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message