Author |
Message
|
dmholmes |
Posted: Fri Jun 25, 2004 1:15 pm Post subject: Documentation on MQ Java API |
|
|
Newbie
Joined: 25 Jun 2004 Posts: 4
|
I'm starting to use MQ via Java API from examples I found. Basic put and retrieve messages. I've looked around on the IBM site and cannot find a basic reference to use MQ in Java. Does anyone have a link or good book to refer? Also I spent alot of time trying to connect to MQ using JMS before discovering that you have to use IBM's JDK/JVM. Is there any other way to use JMS with MQ and non-IBM JVM?
Thank you,
David |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jun 25, 2004 1:30 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The manual you want is available from http://www-306.ibm.com/software/integration/mqfamily/library/manualsa/, and is called "Using Java". You can also get there by clicking the "Documentation" button at the top of the page.
You do not, to the best of my knowledge, have to use IBM's JDK or JVM in order to use the Java or JMS APIs. In fact, I've successfully run the Java client on Apple's JDK.
You may, however, have to use a JDK at the correct release level - and some software vendors may not supply a JDK that is at the correct level. But Sun's should always work - if there is one for your platform. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dmholmes |
Posted: Fri Jun 25, 2004 2:00 pm Post subject: |
|
|
Newbie
Joined: 25 Jun 2004 Posts: 4
|
Thanks for the help. Straight Java API is working fine. But I was using a test class that I've been using to use JMS against WebLogic and JBoss, but trying to use it with MQ is not working. I tracked down jar files from MQ and WebSphere for a couple of hours because when you plugin com.ibm.websphere.naming.WsnInitialContextFactory for the JNDI factory I get NoClassDefFoundErrors. I read on another site the IBM's JDK is required which I believe to be true because of the classes that are being looked for. There was some mention of a wrapper to go around whatever JVM you are using to make it work, but I never found it. I gave up on this last exception:
Exception in thread "main" javax.naming.NamingException: Failed to initialize the ORB [Root exception is org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation com.ibm.CORBA.iiop.ORB vmcid: 0x0 minor code: 0 completed: No]
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:293)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:365)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at QueueSend.init(QueueSend.java:51)
at QueueSend.main(QueueSend.java:92)
Caused by: org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation com.ibm.CORBA.iiop.ORB vmcid: 0x0 minor code: 0 completed: No
at org.omg.CORBA.ORB.create_impl(ORB.java:297)
at org.omg.CORBA.ORB.init(ORB.java:336)
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:77)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:9
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:74)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:284)
... 7 more
Caused by: java.lang.NoClassDefFoundError: com/ibm/jvm/ExtendedSystem
at com.ibm.rmi.util.JDKBridge.setCodebaseProperties(JDKBridge.java:226)
at com.ibm.rmi.util.JDKBridge.<clinit>(JDKBridge.java:205)
at com.ibm.rmi.util.RepositoryId.<clinit>(RepositoryId.java:122)
at com.ibm.rmi.iiop.CDROutputStream.<clinit>(CDROutputStream.java:1077)
at com.ibm.rmi.corba.ORB.<init>(ORB.java:250)
at com.ibm.rmi.iiop.ORB.<init>(ORB.java:166)
at com.ibm.CORBA.iiop.ORB.<init>(ORB.java:521)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at org.omg.CORBA.ORB.create_impl(ORB.java:295)
... 14 more
The jar file with this class, ibmorb.jar, is in my classpath. My JVM is 1.4.2_03 running on Apple OS X.
David |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jun 25, 2004 4:57 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
dm
You are partially right!. To get the JMS setup with the class you specified
Quote: |
com.ibm.websphere.naming.WsnInitialContextFactory |
you need to connect to Websphere Application Server as this initial factory will allow you to get the information from WAS.
And yes this is an IBM product so you will need an IBM JVM to run WAS correctly...
Try the file implementation. Create the entries with JMSAdmin. Then use with javax.naming. Should give you no problem and you will only need Sun jvm.
Hope it helps.
 |
|
Back to top |
|
 |
dmholmes |
Posted: Fri Jun 25, 2004 8:13 pm Post subject: |
|
|
Newbie
Joined: 25 Jun 2004 Posts: 4
|
Thanks, I'll give it a try. The other two message servers (WebLogic and JBoss) are coupled with their JNDI, so MQ without the application server would be different. Too busy trying stuff to realize that. |
|
Back to top |
|
 |
dmholmes |
Posted: Mon Jun 28, 2004 7:06 am Post subject: |
|
|
Newbie
Joined: 25 Jun 2004 Posts: 4
|
Are there any javadocs for the MQ API? All I can find are PDF. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jun 28, 2004 7:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
dmholmes wrote: |
Are there any javadocs for the MQ API? All I can find are PDF. |
Nope. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|