new MQConnectionFactory() 在 JBoss 中抛出 NullPointerException

发布于 2024-09-08 07:53:23 字数 1412 浏览 9 评论 0 原文

我正在尝试执行以下命令:

MQConnectionFactory connFactory = new MQConnectionFactory();

我收到一个空指针异常,但我似乎无法追踪该异常。我在下面附上了堆栈跟踪。

java.lang.NullPointerException
  at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
  at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:165)
  at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:271)
  at com.foundation.agent.plugin.JMSClient.createConnection(JMSClient.java:154)
  at com.foundation.agent.plugin.JMSClient.launch(JMSClient.java:108)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)

我正在使用类加载器加载调用 new MQConectionFactory() 的类,因此我怀疑某些 JBoss JMS 库可能导致此问题。

更多信息:

  • com.ibm.mq.runtime_7.0.1.0\lib

Jars:

  • com.ibm.mq.headers.jar
  • com.ibm.mqjms.jar
  • jms.jar
  • com.ibm.mq.jar
  • Connector.jar
  • jta.jar
  • com.ibm.mq.jmqi.jar
  • dhbcore.jar
  • providerutil.jar
  • com.ibm.mq.pcf.jar
  • fscontext.jar

I am trying to execute the following command:

MQConnectionFactory connFactory = new MQConnectionFactory();

I get a null pointer exception that I can't seem to track down. I have attached the stack trace below.

java.lang.NullPointerException
  at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
  at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:165)
  at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:271)
  at com.foundation.agent.plugin.JMSClient.createConnection(JMSClient.java:154)
  at com.foundation.agent.plugin.JMSClient.launch(JMSClient.java:108)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)

I am loading the class that calls the new MQConectionFactory() using a class loader so I suspect that some JBoss JMS library is possibly causing this.

More info:

  • com.ibm.mq.runtime_7.0.1.0\lib

Jars:

  • com.ibm.mq.headers.jar
  • com.ibm.mqjms.jar
  • jms.jar
  • com.ibm.mq.jar
  • connector.jar
  • jta.jar
  • com.ibm.mq.jmqi.jar
  • dhbcore.jar
  • providerutil.jar
  • com.ibm.mq.pcf.jar
  • fscontext.jar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

誰認得朕 2024-09-15 07:53:24

您似乎正在使用 WMQ v7.0.1.0。您是否按照 v7 WMQ 使用 Java 手册?假设采用标准安装,运行时 CLASSPATH 中所需的唯一 jar 是 com.ibm.mqjms.jar。标准安装中有大约 10 个 jar,我在你的列表中没有看到,所以我不确定你是否列出了 CLASSPATH 变量中的内容或 java/lib 中的内容,但这不是我期望的列表。如果您从某处获取了 jar 文件,请尝试使用完整客户端安装

You appear to be using v7.0.1.0 of WMQ. Have you configured your CLASSPATH as described in the v7 WMQ Using Java manual? Assuming a standard install, the only jar you need in the CLASSPATH at runtime is com.ibm.mqjms.jar. There's about 10 jars in the standard install I don't see in your list so I'm not sure if you listed what's in your CLASSPATH variable or what's in the java/lib but it's not the list I'd expect in either case. If you grabbed the jar files from somewhere, try using the full client install

梦初启 2024-09-15 07:53:24

反编译第169行JmsFactoryFactoryImpl的代码,可以看到上面几行有trace输出。在我的系统上,与您遇到的异常相同,系统错误(在我的情况下是 Tomcat 的 catalina.out)上的跟踪输出显示以下内容:

      WorkQueueMananger Contents
                           --------------------------

|   Maintain ThreadPool size     :-  false
|   Maximum ThreadPool size      :-  -1
|   ThreadPool inactive timeout  :-  0
|   unavailable -                :-  com.ibm.msg.client.commonservices.CSIException: JMSCS0002

使用该代码,您可以转到:
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.javadoc.doc%2FWMQJMSClasses%2Ferrorcodes.html

Decompiling the code for JmsFactoryFactoryImpl at line 169, you can see that there is a trace output some lines above. On my system with the same Exception as you had, the trace output on system err (Tomcat's catalina.out in my case) revealed the folllowing:

      WorkQueueMananger Contents
                           --------------------------

|   Maintain ThreadPool size     :-  false
|   Maximum ThreadPool size      :-  -1
|   ThreadPool inactive timeout  :-  0
|   unavailable -                :-  com.ibm.msg.client.commonservices.CSIException: JMSCS0002

And with that code you can go to:
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.javadoc.doc%2FWMQJMSClasses%2Ferrorcodes.html

清秋悲枫 2024-09-15 07:53:24

即使添加了所有必需的 JAR 之后,我也遇到了同样的问题。最后,将我的 JDK 从 IBM JDK 更改为 Oracle/Sun JDK 后问题得到解决。看起来 IBM JDK(独立)没有足够的东西来创建连接工厂。

I faced the same issue even after adding all the required JARs. Finally the issue is resolved after changing my JDK from IBM JDK to Oracle/Sun JDK. looks like IBM JDK (standing alone) doesnt have enough things to create connection factory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文