Author |
Message
|
RogerLacroix |
Posted: Wed Jul 03, 2013 2:21 pm Post subject: JBoss and MQ JNDI |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
All,
I need a little help, so that I can help someone configure their JBoss server to use MQ JNDI. Its like the blind leading the blind.
They are currently using WMQInitialContextFactory and I want them to switch to an MQ JNDI.
Here is how it is configured now:
Code: |
<InitialContextFactory>com.ibm.mq.jms.context.WMQInitialContextFactory</InitialContextFactory>
<ProviderURL>server123:1414/MQ.DEV</ProviderURL> |
Is it as simply as changing it to:
Code: |
<InitialContextFactory>com.sun.jndi.fscontext.RefFSContextFactory</InitialContextFactory>
<ProviderURL>file:/opt/apps/mqjndi</ProviderURL> |
Any help would be appreciated.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Jul 03, 2013 11:39 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Roger,
Aren't the before & after the wrong way round? either that or the words don't agree with the code? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 04, 2013 4:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
It's a little bit more complex and involved. The initial context factory used by the JBoss is a direct link to the qmgr. As such no need to create an initial context.
However you need to create an initial context for the file based JNDI.
Remember also to only use a single level.
To Set up the context (you can then ftp the file in binary mode) use the MQExplorer. You can look up the commands for the JMSAdmin tool and run them in a script, but the quickest way to get started is create your initial context in the MQ Explorer under the JMS tree...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jul 04, 2013 7:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fjb_saper wrote: |
It's a little bit more complex and involved. The initial context factory used by the JBoss is a direct link to the qmgr. As such no need to create an initial context.
However you need to create an initial context for the file based JNDI.
Remember also to only use a single level.
To Set up the context (you can then ftp the file in binary mode) use the MQExplorer. You can look up the commands for the JMSAdmin tool and run them in a script, but the quickest way to get started is create your initial context in the MQ Explorer under the JMS tree...
Have fun  |
I'm with smdavies99 here. The code Roger posted shows that the JNDI is currently making a direct connection to the qmgr and using the qmgr as it's Initial Context and as it's JNDI repository. That's what Roger said he wanted to do.
I think using the qmgr this way is a poor idea, and that the 'default' JNDI repository for JBOSS (whatever that is) should be used as the initial context rather than the external qmgr. This keeps concerns separated - the JNDI knows about only those objects it's supposed to know about, rather than knowing about all objects that the qmgr knows about.
If, somehow, the default JNDI of JBOSS is nonexistant, then using a file as the JNDI repository is an okay idea. It still keeps the separation of concern and the relevant file can indeed be built by the MQ administrator, if needed. Alternately, it can be built by anyone who has access to MQExplorer or an mq command line with the jmsadmin command.
Using the qmgr as a JNDI repository is an idea that sounds clever but ends up being much less help than it seems. Among other things, it makes the startup of your app server much more dependent on the qmgr being running and connectable. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Jul 04, 2013 12:30 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
mqjeff wrote: |
I'm with smdavies99 here. The code Roger posted shows that the JNDI is currently making a direct connection to the qmgr and using the qmgr as it's Initial Context and as it's JNDI repository. That's what Roger said he wanted to do. |
OMG!! I said:
RogerLacroix wrote: |
They are currently using WMQInitialContextFactory and I want them to switch to an MQ JNDI. |
They have not yet switched. Hence, the "configured now" example still shows them using WMQInitialContextFactory class.
The "changing to" example refers to the future if I can convince them to use MQ JNDI.
fjb_saper wrote: |
However you need to create an initial context for the file based JNDI. |
I use MQ JNDI all the time, I thought the initial context was created by default.
I prefer to use JMSAdmin and I create my QCFs and Qs as follows:
Code: |
DEFINE QCF(myQCF) QMANAGER(MQWT1) CHANNEL(MQ.DEV) HOSTNAME(127.0.0.1) PORT(1414) TRANSPORT(CLIENT) FAILIFQUIESCE(YES)
DEFINE Q(mqs.dev.test.q) QUEUE(TEST1) QMANAGER(MQWT1) TARGCLIENT(JMS) FAILIFQUIESCE(YES) |
fjb_saper wrote: |
Remember also to only use a single level. |
Actually, I don't think I have ever created more than one level.
What I am after is info on how to switch them from using WMQInitialContextFactory to MQ JNDI for JBoss.
Like I asked:
RogerLacroix wrote: |
Is it as simply as changing it to:
Code: |
<InitialContextFactory>com.sun.jndi.fscontext.RefFSContextFactory</InitialContextFactory>
<ProviderURL>file:/opt/apps/mqjndi</ProviderURL> |
|
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 04, 2013 6:05 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
RogerLacroix wrote: |
Like I asked:
RogerLacroix wrote: |
Is it as simply as changing it to:
Code: |
<InitialContextFactory>com.sun.jndi.fscontext.RefFSContextFactory</InitialContextFactory>
<ProviderURL>file:/opt/apps/mqjndi</ProviderURL> |
|
Regards,
Roger Lacroix
Capitalware Inc. |
Yes it is as simple as the switch you're showing in the JNDI admin console of JBOSS while referencing the foreign JNDI provider. This of course supposes that you did build the initial context just like you said you did.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jul 05, 2013 7:14 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
RogerLacroix wrote: |
mqjeff wrote: |
I'm with smdavies99 here. The code Roger posted shows that the JNDI is currently making a direct connection to the qmgr and using the qmgr as it's Initial Context and as it's JNDI repository. That's what Roger said he wanted to do. |
OMG!! I said:
RogerLacroix wrote: |
They are currently using WMQInitialContextFactory and I want them to switch to an MQ JNDI. |
They have not yet switched. Hence, the "configured now" example still shows them using WMQInitialContextFactory class.
The "changing to" example refers to the future if I can convince them to use MQ JNDI. |
"MQ JNDI" is not a term that has meaning. I read "MQ JNDI" as "Using the qmgr as a JNDI repository". You apparently mean it as "Using MQ to build a file-based JNDI repository". smdavies99 apparently agrees with me, and reads it the same way I did. Or, I should say, I agree with how smdavies99 read it.
In theory "MQ JNDI" could mean either one of those, or both of those, or neither - it could mean WebSphere's JNDI that happens to hold MQ objects. |
|
Back to top |
|
 |
|