从独立代码访问队列

发布于 2024-08-07 05:16:22 字数 5167 浏览 3 评论 0原文

我在 Rational Application Developer for WebSphere 中配置了一个队列,使用“V5 默认消息传递提供程序”和 Websphere6.1

我现在尝试使用独立应用程序(JUnit Test)访问它,以便在其中放入一些消息。我目前使用以下代码:

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
                "com.ibm.websphere.naming.WsnInitialContextFactory");
        env.put(Context.PROVIDER_URL, "corbaloc::localhost:2809"); 
        InitialContext ctx = new InitialContext(env);

        javax.jms.Queue queue = (javax.jms.Queue) ctx.lookup("Topic");

在最后一行,我得到以下异常:

javax.naming.NamingException: The JNDI operation "lookupExt"on the context "vwagwolot0awNode01Cell/nodes/vwagwolot0awNode01/servers/server1" with the name "Topic" failed.  Please get the root cause Throwable contained in this NamingException for more information.  Root exception is java.lang.NoSuchMethodError: com.ibm.ejs.ras.TraceComponent: method isAnyTracingEnabled()Z not found
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.register(PmiReqMetrics.java:949)
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.<clinit>(PmiReqMetrics.java:273)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1505)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1358)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
    at javax.naming.InitialContext.lookup(InitialContext.java:361)
    at de.volkswagen.oracle.provisioning.util.test.QueueTest.testQueue(QueueTest.java:33)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at junit.framework.TestCase.runTest(TestCase.java:164)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:120)
    at junit.framework.TestSuite.runTest(TestSuite.java:230)
    at junit.framework.TestSuite.run(TestSuite.java:225)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
root cause:
java.lang.NoSuchMethodError: com.ibm.ejs.ras.TraceComponent: method isAnyTracingEnabled()Z not found
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.register(PmiReqMetrics.java:949)
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.<clinit>(PmiReqMetrics.java:273)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1505)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1358)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
    at javax.naming.InitialContext.lookup(InitialContext.java:361)
    at <package name here>.QueueTest.testQueue(QueueTest.java:33)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at junit.framework.TestCase.runTest(TestCase.java:164)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:120)
    at junit.framework.TestSuite.runTest(TestSuite.java:230)
    at junit.framework.TestSuite.run(TestSuite.java:225)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

任何提示,我可以做什么来修复它? 为了做到这一点,我将 ws_runtime.jar 添加到类路径中,我在 RAD 安装中的某个位置找到了该路径。

I have a Queue configured in the Rational Application Developer for WebSphere, using a "V5 default messaging provider" and a Websphere6.1

I now try to access it using a standalone app (JUnit Test), in order to put some messages in it. I currently use the following code:

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
                "com.ibm.websphere.naming.WsnInitialContextFactory");
        env.put(Context.PROVIDER_URL, "corbaloc::localhost:2809"); 
        InitialContext ctx = new InitialContext(env);

        javax.jms.Queue queue = (javax.jms.Queue) ctx.lookup("Topic");

On the last line I get the following exception:

javax.naming.NamingException: The JNDI operation "lookupExt"on the context "vwagwolot0awNode01Cell/nodes/vwagwolot0awNode01/servers/server1" with the name "Topic" failed.  Please get the root cause Throwable contained in this NamingException for more information.  Root exception is java.lang.NoSuchMethodError: com.ibm.ejs.ras.TraceComponent: method isAnyTracingEnabled()Z not found
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.register(PmiReqMetrics.java:949)
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.<clinit>(PmiReqMetrics.java:273)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1505)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1358)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
    at javax.naming.InitialContext.lookup(InitialContext.java:361)
    at de.volkswagen.oracle.provisioning.util.test.QueueTest.testQueue(QueueTest.java:33)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at junit.framework.TestCase.runTest(TestCase.java:164)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:120)
    at junit.framework.TestSuite.runTest(TestSuite.java:230)
    at junit.framework.TestSuite.run(TestSuite.java:225)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
root cause:
java.lang.NoSuchMethodError: com.ibm.ejs.ras.TraceComponent: method isAnyTracingEnabled()Z not found
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.register(PmiReqMetrics.java:949)
    at com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.<clinit>(PmiReqMetrics.java:273)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1505)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1358)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
    at javax.naming.InitialContext.lookup(InitialContext.java:361)
    at <package name here>.QueueTest.testQueue(QueueTest.java:33)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at junit.framework.TestCase.runTest(TestCase.java:164)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:120)
    at junit.framework.TestSuite.runTest(TestSuite.java:230)
    at junit.framework.TestSuite.run(TestSuite.java:225)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Any hints, what I can do in order to fix it?
In order to get that far, I added the ws_runtime.jar into the classpath, which I found somewhere in the RAD installation.

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

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

发布评论

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

评论(1

本王不退位尔等都是臣 2024-08-14 05:16:22

您可能需要检查类路径上有哪些 JAR。粗略地一看就表明某处不匹配。这一行:

java.lang.NoSuchMethodError: com.ibm.ejs.ras.TraceComponent: method isAnyTracingEnabled()Z not found

告诉您 com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.register 方法正在尝试调用 TraceComponent 上的 isAnyTracingElementEnabled 方法code>,但 TraceComponent 没有该方法。我猜测包含 TraceComponent 的 JAR 是错误的。

You may want to check which JARs you have on the classpath. A cursory glance is indicating a mismatch somewhere. This line:

java.lang.NoSuchMethodError: com.ibm.ejs.ras.TraceComponent: method isAnyTracingEnabled()Z not found

Is telling you that the com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.register method is trying to call the isAnyTracingElementEnabled method on TraceComponent, but TraceComponent doesn't have that method. I'm guessing that the JAR that has TraceComponent in is the wrong one.

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