简体   繁体   English

使用MQ的Java存储过程

[英]Java Stored Procedure using MQ

I need to create a Java stored procedure in Oracle. 我需要在Oracle中创建一个Java存储过程。 I have used IBM's sample class for creating an MQ message from a simple class outside of Java EE environment. 我使用IBM的示例类从Java EE环境之外的简单类创建MQ消息。 I have tested the class by itself and it is working. 我已经单独测试了该类,并且该类正在运行。

My Oracle vesrion is 11i. 我的Oracle版本是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. 当我尝试添加简单应用程序中使用的jar并将其与我的简单类一起加载到Oralce时,即使在测试用例中使用相同的jar,我也会遇到未找到类的错误。 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 我遇到的错误种类是这样的-v标志,带有客户机上的loadjava实用程序

on line 326 / 327, you see this: 在326/327行,您会看到以下内容:

creating : class com/ibm/mq/jms/admin/AP loading : class com/ibm/mq/jms/admin/AP 创建:com / ibm / mq / jms / admin / AP类加载: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: 然后在从行6224到结尾的结尾处,表明上述类无法解析:

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 com / ibm / mq / jms / admin / APRCXI:ORA-29534:无法解析引用的对象xxxx.com/ibm/mq/jms/admin/AP com / ibm / mq / jms / admin / APSDX:ORA-29534 :无法解析引用的对象xxxx.com/ibm/mq/jms/admin/AP退出:解决类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 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. 我还尝试了使用-genmissing选项和一些其他jar(在这里找到列表),但是对于其他类仍然遇到类似的错误。

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. 我面临的另一个问题是,如果遇到错误并尝试使用Oracle的dropjava命令,那么它也不起作用。

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. 我也看到了这个链接,这个人是成功的,但不幸的是,他/她没有说明他们是如何使用loadjava加载的罐子。

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. 如果有人对如何获取Java存储过程以将IBM MQ与Oracle 11i配合使用有任何想法,我将非常感谢您的帮助。

Found a detailed answer in this blog entry. 博客条目中找到了详细的答案。 I tried it and it worked for me. 我尝试过,它对我有用。

In Oracle there is no concept of CLASSPATH, so the standard MQ Client install is useless. 在Oracle中,没有CLASSPATH的概念,因此标准的MQ Client安装是没有用的。 You can only load the jars reference by your app within the database schema. 您只能在数据库架构中由您的应用加载jar引用。 Classes are resolved when loaded with the -r option. 使用-r选项加​​载时可解析类。 You can further on specify your own resolved using -r -Resolver (schemas). 您可以进一步使用-r -Resolver (方案)指定自己的解决方案。 (check Oracle docs for exact format). (检查Oracle文档中的确切格式)。 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. 在Java中使用Websphere MQ类会带来许多问题,您必须确保Oracle JDK版本在适当的支持级别上才能连接到所选的MQ服务器版本。 Check the system requirements for websphere MQ Vx.x. 检查Websphere MQ Vx.x的系统要求。 You should find IBM's web references. 您应该找到IBM的Web参考。 check the support for MQ classed for java. 检查对Java分类的MQ的支持。

I have such an issue at the moment trying to connect to Mq using Oracle 10 and JDK 1.4.2. 我现在尝试使用Oracle 10和JDK 1.4.2连接到Mq时遇到这样的问题。 I had to recompile my Java code using JDK 1.4.x. 我不得不使用JDK 1.4.x重新编译Java代码。 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. 这是行不通的,我认为是因为我连接到MQ 7.0.1.7,它最低要求JRE 1.7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM