jboss and SunOne with LDAP: adding queue/queuename via admin GUI

Hi All,

I'm using SunOne MQ as jboss jms provider, I succedded in configuring the external provider, but I 'm obliged to create via the SunOne MQ admin GUI queues and topics destinations named as jboss want:

queue/myqueue as a queue name

or

topic/mytopicname

The problem is that my SunOne is using an LDAP server to store destination names and other stuff, and when adding these queues and topic names with the queue/ and topic/ prefix, I have a naming crash, also using queue\/myqueuename as esc sequence.

Does anyone of you succeeded in creating such a name for destinations via the GUI ?

Thanks.

Stefano.

[681 byte] By [stfalcon] at [2007-11-25 17:03:34]
# 1

Hi Stefano,

First of all, what exactly is the error you are seeing ?

The problem here is that the MQ tools do not handle the

creation of JNDI subcontexts based on a hierarchical

lookup name. I don't think trying to escape the slashes

will help here. For example, if you specify:

JNDI/Object Store attributes:

java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory

java.naming.provider.url=ldap://server:389/ou=JMSObj,o=top

...

Lookup name for new object:

cn=queue/myqueue(Most LDAP servers require the

cn=... syntax)

An error will occur because the MQ admin console will not

create a 'queue' JNDI subcontext under the hierarchy

"ldap://server:389/ou=JMSObj,o=top".

In general, lookup names with "/" in them do not work

well in MQ (even with file system context).

Can you try the following workaround ? It involves a bit

more setup but it might work.

From my understanding, you:

- need to maintain a JNDI 'path' of queue/myqueue (for

your jboss setup)

- but need to avoid specifying queue/myqueue to MQ

admin console

You need to first manually create the hierarchy (via your

LDAP server's admin console). You basically need to create

the "queue" subcontext under what is your root/top LDAP

context. You must have had to do some of this

to create the basic top or root of the object store.

Once that is done, you can use the MQ admin console as before, but

now you point one level deeper. The lookup name will then be "myqueue"

instead of "queue/myqueue". Using the example above, this can

look like:

JNDI/Object Store attributes:

java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory

java.naming.provider.url=ldap://server:389/ou=queue,ou=JMSObj,o=top

...

Lookup name for new object:

cn=myqueue

This may work but it makes things slightly inconvenient. If you need to

create objects at:

queue/myqueue

queueA/anotherqueue

queueB/yetanotherqueue

You have to repeat the steps above for each new subcontext.

hope this helps,

-isa

isahashim at 2007-7-3 0:15:49 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 2

Hi Isa,

and thanks, I was approaching the problem in the same way, with an LDAP administration tool I created (I hope I'm not well with LDAP) a subcontext called queue and another one called topic, then using the console (before I had a naming aexception or wrong DN error on the openldap dubug trace) I added using the console on SunOne 3.5 sp1 the string "cn=queue/myQueueName" with the " included in the actual name I used. This was added without naming exception from the console. Here I'm adding the LDAP trace for the operation succesfull and the same with errors:

JBOSS

conn=4 fd=12 ACCEPT from IP=10.110.85.22:2430 (IP=0.0.0.0:389)

conn=4 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=4 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=4 op=0 RESULT tag=97 err=0 text=

conn=4 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=com" scope=0 filter="(objectClass=*)"

conn=4 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

do_search: invalid dn (queue,cn=Manager,dc=my-office,dc=com)

conn=4 op=2 RESULT tag=101 err=34 text=invalid DN

conn=4 op=3 UNBIND

conn=4 fd=12 closed

conn=5 fd=12 ACCEPT from IP=10.110.85.22:2433 (IP=0.0.0.0:389)

conn=5 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=5 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=5 op=0 RESULT tag=97 err=0 text=

conn=5 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=com" scope=0 filter="(objectClass=*)"

conn=5 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

do_search: invalid dn (queue,cn=Manager,dc=my-office,dc=com)

conn=5 op=2 RESULT tag=101 err=34 text=invalid DN

conn=5 op=3 UNBIND

conn=5 fd=12 closed

conn=6 fd=12 ACCEPT from IP=10.110.85.22:2439 (IP=0.0.0.0:389)

conn=6 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=6 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=6 op=0 RESULT tag=97 err=0 text=

conn=6 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=com" scope=0 filter="(objectClass=*)"

conn=6 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

do_search: invalid dn (queue,cn=Manager,dc=my-office,dc=com)

conn=6 op=2 RESULT tag=101 err=34 text=invalid DN

conn=6 op=3 UNBIND

conn=6 fd=12 closed

Running impl

conn=11 fd=16 ACCEPT from IP=10.110.85.20:3863 (IP=0.0.0.0:389)

conn=11 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=11 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=11 op=0 RESULT tag=97 err=0 text=

conn=11 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=com" scope=0 filter="(objectClass=*)"

conn=11 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

conn=12 fd=17 ACCEPT from IP=10.110.85.20:3866 (IP=0.0.0.0:389)

conn=12 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=12 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=12 op=0 RESULT tag=97 err=0 text=

conn=12 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=com" scope=0 filter="(objectClass=*)"

conn=12 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

conn=13 fd=18 ACCEPT from IP=10.110.85.20:3869 (IP=0.0.0.0:389)

conn=13 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=13 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=13 op=0 RESULT tag=97 err=0 text=

conn=13 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=com" scope=0 filter="(objectClass=*)"

conn=13 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

conn=14 fd=19 ACCEPT from IP=10.110.85.20:3872 (IP=0.0.0.0:389)

conn=14 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=14 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=14 op=0 RESULT tag=97 err=0 text=

conn=14 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=com" scope=0 filter="(objectClass=*)"

conn=14 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

conn=15 fd=20 ACCEPT from IP=10.110.85.20:3875 (IP=0.0.0.0:389)

conn=15 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=15 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPL

I'm also trying using the subcontext exactly as you specified.

Now the jboss crash is this one:

10:11:02,218 INFO [STDOUT] Getting the Queuefactory ref [cn=LdapQueueConnectionFactory]

10:11:02,843 ERROR [DLQHandler] Initialization failed

javax.jms.JMSException: Error creating the dlq connection: queue: [LDAP: error code 34 - invalid DN]

at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:169)

at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:158)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerCreate(JMSContainerInvoker.java:458)

at org.jboss.ejb.plugins.jms.JMSContainerInvoker.startService(JMSContainerInvoker.java:674)

at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)

at org.jboss.ejb.MessageDrivenContainer.startService(MessageDrivenContainer.java:234)

at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)

that on the LDAP correspond to this trace:

conn=22 fd=19 ACCEPT from IP=10.110.85.22:1197 (IP=0.0.0.0:389)

conn=22 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" method=128

conn=22 op=0 BIND dn="cn=Manager,dc=my-office,dc=com" mech=SIMPLE ssf=0

conn=22 op=0 RESULT tag=97 err=0 text=

conn=22 op=1 SRCH base="cn=LdapQueueConnectionFactory,cn=Manager,dc=my-office,dc=c

om" scope=0 filter="(objectClass=*)"

conn=22 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=

do_search: invalid dn (queue,cn=Manager,dc=my-office,dc=com)

conn=22 op=2 RESULT tag=101 err=34 text=invalid DN

conn=22 op=3 UNBIND

conn=22 fd=19 closed

conn=15 op=63 SRCH base="cn=topic,cn=Manager,dc=my-office,dc=com" scope=0 filter="

(objectClass=*)"

conn=15 op=63 SRCH attr=* altServer attributeTypes createTimestamp creatorsName

matchingRules matchingRuleUse modifiersName modifyTimestamp namingContexts objec

tClasses subschemaSubentry supportedControl supportedExtension supportedLDAPVers

ion supportedSASLMechanisms

conn=15 op=64 SRCH base="cn=topic,cn=Manager,dc=my-office,dc=com" scope=1 filter="

(objectClass=*)"

conn=15 op=64 SRCH attr=1.1

conn=15 op=63 SEARCH RESULT tag=101 err=0 nentries=1 text=

conn=15 op=64 SEARCH RESULT tag=101 err=0 nentries=8 text=

Any idea ?

stfalcon at 2007-7-3 0:15:49 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 3

Hi again Isa, also another issue: If I call a queue as

cn=queue/myqueuename

or

cn=queuename I will always have

queue/cn=queue/myqueuename

or

queue/cn=queuename

that anyway has not the cn= or something else for LDAP at the beginning of the search string, as jboss will always put at the beginning the usual queue/ or topic/ prefix, making wrong the lookup name.

Stefano.

stfalcon at 2007-7-3 0:15:49 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 4

Ok, the reason is clear, from the jboss source:

// FIXME: This is not portable, only works for JBossMQ

if (queue == null)

queue = (Queue)createDestination(Queue.class,

context,

"queue/" + jndiSuffix,

jndiSuffix);

Any idea for a workaround ?

stfalcon at 2007-7-3 0:15:49 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 5

Ok patched the jboss class org.jboss.ejb.plugins.jms.JMSContainerInvoker

removing concatenation of static strings "queue/" and "topic/"

if (queue == null)

queue = (Queue)createDestination(Queue.class,

context,

jndiSuffix,

jndiSuffix);

and

if (topic == null)

topic = (Topic)createDestination(Topic.class,

context,

jndiSuffix,

jndiSuffix);

All seems to work fine and SunOne 3.5 sp1 is working as jboss 3.2.3 and 3.2.4 jms provider, also if not all tests have been performed yet. This means that anyway we have absolutely to keep trace of the changes performed in jboss.

Great! Great open source!

Thanks all !!!

Stefano.

stfalcon at 2007-7-3 0:15:49 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 6

Ok patched the jboss class org.jboss.ejb.plugins.jms.JMSContainerInvoker

removing concatenation of static strings "queue/" and "topic/"

if (queue == null)

queue = (Queue)createDestination(Queue.class,

context,

jndiSuffix,

jndiSuffix);

and

if (topic == null)

topic = (Topic)createDestination(Topic.class,

context,

jndiSuffix,

jndiSuffix);

All seems to work fine and SunOne 3.5 sp1 is working as jboss 3.2.3 and 3.2.4 jms provider, also if not all tests have been performed yet. This means that anyway we have absolutely to keep trace of the changes performed in jboss.

The adaptor used as the only class needed to performe the integration was this one, to put in jboss.jar

package org.jboss.jms.jndi;

import org.jboss.jms.jndi.JMSProviderAdapter;

import java.util.Hashtable;

import javax.naming.*;

public class JMSProviderAdapterSunOneImpl implements JMSProviderAdapter {

private String name = null;

private String providerUrl = null;

private String queueFactoryRef = null;

private String topicFactoryRef = null;

public Context getInitialContext() throws NamingException{

System.out.println("GetinitialContext called");

Hashtable contextEnvironment = new Hashtable();

/*

// To bind Fiorano MQ use these

env.put (Context.SECURITY_PRINCIPAL, "anonymous");

env.put (Context.SECURITY_CREDENTIALS, "anonymous");

env.put(Context.PROVIDER_URL,getProviderUrl());

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.INITIAL_CONTEXT_FACTORY,"fiorano.jms.runtime.naming.FioranoInitialContextFactory");

*/

//**//

contextEnvironment.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");

//Something like ldap://10.10.10.10/cn=Manager,dc=my-domain,dc=com

contextEnvironment.put("java.naming.provider.url", "ldap://10.10.10.10/cn=Manager,dc=my-office,dc=com");

//Something like cn=Manager,dc=my-domain,dc=com

contextEnvironment.put("java.naming.security.principal", "cn=Manager,dc=my-office,dc=com");

//Something like simple

contextEnvironment.put("java.naming.security.authentication","simple");

//Something like mypassword

contextEnvironment.put("java.naming.security.credentials", "secret");

//**//

System.out.println("#############################################################");

System.out.println("#############################################################");

System.out.println("#############################################################");

System.out.println("#############################################################");

System.out.println("### SunOne Jms Provider Adapter context built succesfully ###");

System.out.println("#############################################################");

System.out.println("#############################################################");

System.out.println("#############################################################");

System.out.println("#############################################################");

InitialContext ic = new InitialContext(contextEnvironment);

try{

com.sun.messaging.Queue queue = (com.sun.messaging.Queue) ic.lookup("cn=MyLdapQueue");

System.out.println("_");

System.out.println("_");

System.out.println("Data found for the queue looked up:");

System.out.println(queue.toString());

System.out.println("_");

System.out.println("_");

}catch(Exception exc){

System.out.println("Test !!!!!!!!!! failed !!!!!!!!!");

exc.printStackTrace();

}

return ic;

}

public String getName()

{

System.out.println("Getting the name [" + name + "]");

return name;

}

public String getProviderUrl(){

System.out.println("Getting the provider URL [" + providerUrl + "]");

return providerUrl;

}

public String getQueueFactoryRef(){

System.out.println("Getting the Queuefactory ref [" + queueFactoryRef + "]");

return queueFactoryRef;

}

public String getTopicFactoryRef(){

System.out.println("Getting the Topicfactory ref [" + topicFactoryRef + "]");

return topicFactoryRef;

}

public void setName(String jndiName){

System.out.println("The name is set to [" + jndiName + "]");

name = jndiName;

}

public void setProviderUrl(String provUrl){

System.out.println("The URL is set to [" + provUrl + "]");

providerUrl = provUrl;

}

public void setQueueFactoryRef(String queueFactory){

System.out.println("The QueueRef is set to [" + queueFactory + "]");

queueFactoryRef = queueFactory;

}

public void setTopicFactoryRef(String topicFactory){

System.out.println("The Topic ref is set to [" + topicFactory + "]");

topicFactoryRef = topicFactory;

}

}

Great! Great open source!

Thanks all !!!

Stefano.

stfalcon at 2007-7-3 0:15:49 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...