2

I need to create a Java stored procedure in Oracle. I have used IBM's sample class for creating an MQ message from a simple class outside of Java EE environment. I have tested the class by itself and it is working.

My Oracle vesrion is 11i.

When I am trying to add the jars used in the simple application to load to Oralce along with my simple class, I am getting errors about class not found, even if same jars work with the test case. I am stuck with this for over a week and am desperately hoping that someone would be able to help me with it.

Kinds of errors I am getting are like this from -v flag with loadjava utility on the client

on line 326 / 327, you see this:

creating : class com/ibm/mq/jms/admin/AP loading : class com/ibm/mq/jms/admin/AP

and then at the end starting from line 6224 to end, it indicates that the above class can’t be resolved:

com/ibm/mq/jms/admin/APRCXI: ORA-29534: referenced object xxxx.com/ibm/mq/jms/admin/AP could not be resolved com/ibm/mq/jms/admin/APSDX: ORA-29534: referenced object xxxx.com/ibm/mq/jms/admin/AP could not be resolved exiting : errors resolving class com/ibm/mq/jms/admin/AP

the command I used is:

c:\Oracle\product\11.2.0\client_1\bin\loadjava.bat -f -jarsasdbobjects -prependjarnames -stoponerror -u xxxx/yyyy@SID -v -resolve lib\jms.jar lib\com.ibm.mqjms.jar lib\com.ibm.mq.jmqi.jar lib\dhbcore.jar lib\fscontext.jar src\com\test\javasp\mq\JmsProducer.java

I also tried with -genmissing option with some additional jars ( list I found here ), but still get similar error for a different class.

Other issue with this that I am facing is that if I get an error and try to use the dropjava command from Oracle, it doesn't work either.

I also saw from this link, that this person was successful, but unfortunately, he/she didn't indicate how they used loadjava to load the jars.

If i can provide any other information, please let me know.

If anyoneone has any idea on how to get the Java Stored Procedure to use IBM MQ working with Oracle 11i, I would really appreciate the help.

Community
  • 1
  • 1
adbdkb
  • 1,897
  • 6
  • 37
  • 66
  • The IBM WMQ classes have been repackaged several times. Which version of WMQ client are you using? – T.Rob Jul 03 '12 at 20:05
  • If you install the full WMQ client then you have the dspmqver, trace and JMSAdmin (to create and edit administered objects) plus the ability to apply maintenance and patches. Please see http://stackoverflow.com/questions/10957612/what-is-the-latest-websphere-mq-client-version/10957643#10957643 for download locations. The WMQ classes bundled with other applications are not necessarily the full functionality or something you can apply maintenance to. If you don't wish to install the full client, I can't help but perhaps someone else here can. – T.Rob Jul 03 '12 at 21:42
  • I have not done much MQ development ( this is the first one, that too using a sample ) so, if my question sounds a little odd, please forgive me. I was given the project interchange for this project that included the jars, but I think ( was told ) they are for MQ 7. So, I presume this would make it client version 7.0. Is there a way for me to confirm it? – adbdkb Jul 03 '12 at 21:49
  • Sorry, I was editing the comment when you responded to my earlier comment. Couple of questions for your second comment - Will I need to get all the jars from that client or just the ones that are making my current program run as a java application. Also, Would it matter which minor version from the WMQ 7 jars I download. If true, how do I find out from my application, which one do I need to use for our MQ installation? Thank you so much for your help – adbdkb Jul 03 '12 at 21:56
  • The IBM supported method is to run the installer and then point your CLASSPATH at the directory where the client jars were installed. If you get v7.1 or v7.5 then you have the option to install anywhere on the host (although you still need to be root or admin to perform the install). I'd go with v7.5. It can connect to any version of WMQ and contains fixes for the known bugs as well as giving best performance. See the Infocenter link in the previous comment for install and verification guidance. An easy way to get the CLASSPATH right is to run the setjmsenv command and then `echo CLASSPATH`. – T.Rob Jul 03 '12 at 23:32
  • The problem is that when loading the classes in Oracle as jars or otherwise, you cannot specify the classpath. You need to list all the jars that need to be loaded. I am able to successfully run the code as a standalone class. But now I need to turn this into a Java Stored Procedure in Oracle and that is where I am encountering the issues that I mentioned in my initial post – adbdkb Jul 04 '12 at 09:19
  • In that case you are *still* better off with the later versions because the number of jars to load is greatly reduced. Unfortunately, I can't help with the Oracle side and it doesn't look like anyone else is chiming in. – T.Rob Jul 04 '12 at 11:10
  • Thank you for the help. I downloaded the latest jars. I do hope that someone chimes in for the loading to Oracle part. – adbdkb Jul 04 '12 at 13:06

2 Answers2

1

Found a detailed answer in this blog entry. I tried it and it worked for me.

adbdkb
  • 1,897
  • 6
  • 37
  • 66
  • I did follow the instructions in the blog, unfortunately I am still at the point that I get an exception with either java.lang.ExceptionInInitializerError or classnotfound error. Did you do anything in addition to what is described in the blog? Thanks! – Paul Fennema Nov 08 '17 at 15:45
0

In Oracle there is no concept of CLASSPATH, so the standard MQ Client install is useless. You can only load the jars reference by your app within the database schema. Classes are resolved when loaded with the -r option. You can further on specify your own resolved using -r -Resolver (schemas). (check Oracle docs for exact format). So in effect the database schemas becomes the classpath.

Using Websphere MQ classes for Java poses a number of problems, you have to ensure that the Oracle JDK version is at an appropriate support level to connect to the chosen MQ server version. Check the system requirements for websphere MQ Vx.x. You should find IBM's web references. check the support for MQ classed for java.

I have such an issue at the moment trying to connect to Mq using Oracle 10 and JDK 1.4.2. I had to recompile my Java code using JDK 1.4.x. This does not work and I assume it is because I connect to MQ 7.0.1.7 which requires JRE 1.7 as minimum.

rynmrtn
  • 3,371
  • 5
  • 28
  • 44
JakesIV
  • 41
  • 4