我在为WebSphere的合理应用开发者构成的队列,使用“V5默认消息提供”和Websphere6.1

我现在尝试使用一个独立的应用程序(JUnit测试)来访问它,为了把一些信息在里面。我目前使用以下代码:

        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安装在什么地方找到。

有帮助吗?

解决方案

您可能要检查你的类路径上,其JAR文件。粗略地看一眼某处表示不匹配。这一行:

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

时告诉您com.ibm.websphere.pmi.reqmetrics.PmiReqMetrics.register方法试图呼吁isAnyTracingElementEnabledTraceComponent方法,但TraceComponent没有该方法。我猜测,在已TraceComponent的JAR是错误的一个。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top