2013-03-26 357 views
0

我正在運行一個Jboss 6.1,我試圖從eclipse做一個測試,我在jboss上查找一個ejb。但它引發了一個異常。有沒有人看過它,知道如何解決它?jboss遠程查找拋出異常

(我已經把所有的罐子從我的JBoss的安裝路徑/客戶/ *。JAR在classpath。)

我的pom.xml依賴

<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax</groupId> 
     <artifactId>javaee-api</artifactId> 
     <version>6.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.testng</groupId> 
     <artifactId>testng</artifactId> 
     <version>6.8</version> 
    </dependency> 
    <dependency> 
     <groupId>org.jboss.ejb3</groupId> 
     <artifactId>jboss-ejb3-ext-api</artifactId> 
     <version>2.0.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.jboss.remoting3</groupId> 
     <artifactId>jboss-remoting</artifactId> 
     <version>3.2.15.GA</version> 
    </dependency> 
    <dependency> 
     <groupId>org.jboss.marshalling</groupId> 
     <artifactId>jboss-marshalling</artifactId> 
     <version>1.3.17.GA</version> 
    </dependency> 
    <dependency> 
     <groupId>org.jboss</groupId> 
     <artifactId>jboss-ejb-client</artifactId> 
     <version>1.0.16.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>jboss</groupId> 
     <artifactId>jbossall-client</artifactId> 
     <version>4.2.2.GA</version> 
    </dependency> 
    <dependency> 
     <groupId>org.mockito</groupId> 
     <artifactId>mockito-all</artifactId> 
     <version>1.9.5</version> 
    </dependency> 
    </dependencies> 

異常堆棧跟蹤

java.lang.ClassCastException: org.jboss.aop.joinpoint.MethodInvocation cannot be cast to org.jboss.ejb3.proxy.impl.invocation.StatefulRemoteInvocation 
    at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:507) 
    at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53) 
    at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91) 
    at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) 
    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967) 
    at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791) 
    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744) 
    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548) 
    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234) 
    at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163) 
    at org.jboss.remoting.Client.invoke(Client.java:1634) 
    at org.jboss.remoting.Client.invoke(Client.java:548) 
    at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61) 
    at $Proxy10.invoke(Unknown Source) 
    at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185) 
    at $Proxy9.save(Unknown Source) 
    at se.questify.services.ServiceTest.CreateQuestionWithResource(ServiceTest.java:56) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) 
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) 
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) 
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) 
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128) 
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) 
    at org.testng.TestRunner.privateRun(TestRunner.java:767) 
    at org.testng.TestRunner.run(TestRunner.java:617) 
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) 
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) 
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) 
    at org.testng.SuiteRunner.run(SuiteRunner.java:240) 
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203) 
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1128) 
    at org.testng.TestNG.run(TestNG.java:1036) 
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) 
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) 
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) 
    at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143) 
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 
    at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61) 
    at $Proxy10.invoke(Unknown Source) 
    at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185) 
    at $Proxy9.save(Unknown Source) 
    at se.questify.services.ServiceTest.CreateQuestionWithResource(ServiceTest.java:56) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) 
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) 
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) 
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) 
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128) 
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) 
    at org.testng.TestRunner.privateRun(TestRunner.java:767) 
    at org.testng.TestRunner.run(TestRunner.java:617) 
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) 
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) 
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) 
    at org.testng.SuiteRunner.run(SuiteRunner.java:240) 
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203) 
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1128) 
    at org.testng.TestNG.run(TestNG.java:1036) 
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) 
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) 
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) 

回答

0

只是一個猜測。您已添加到來自JBOSS_HOME/client的classpath jar,並且您有

<dependency> 
    <groupId>jboss</groupId> 
    <artifactId>jbossall-client</artifactId> 
    <version>4.2.2.GA</version> 
</dependency> 

在您的pom。機會是來自JBOSS_HOME/client的類和來自jbossall-client的類混合在一起,所以你得到了ClassCastException。由於您使用的是JBoss 6,因此4.2.2.GA的jbossall-client類可能無法正常工作。

+0

我會在今天晚些時候嘗試。感謝您的反饋 – Marthin 2013-03-27 06:55:18

+0

我現在試圖從pom中刪除所有jboss依賴關係,只使用/ client/* jar,但仍然是相同的異常 – Marthin 2013-04-01 15:12:10