2010-10-21 71 views
0

我得到这个例外 -ClassCast异常问题

【JAVA]例外在线程“主要” java.lang.ClassCastException:java.lang.Object中不能转换为ws.v1.tmf854.snc.http。 GetAllExplicitPathsResponse

虽然我有适当的代码铸造。 看看下面的代码。

  Object t = expRPC.getAllExplicitPaths(mtosiHeader, mtosiBody); 
      //expList = expRPC.getAllExplicitPaths(mtosiHeader, mtosiBody); 


      System.out.println("Type---->"+t.getClass()+ t.hashCode() + t.toString()); 

expList的类型是getAllExplicitPaths()的期望返回类型。 因为我得到了classcast exp,我铸造它以键入Object。

我仍然得到同样的错误。

任何帮助appriciated。

谢谢...

+6

有代码中没有蒙上你张贴,所以它必须在一些代码,你*没有*发布。 – 2010-10-21 06:00:13

+0

确实。我猜你正在使用的RPC代码中发生了转换。我也猜测你生成了它。 – 2010-10-21 08:28:18

+0

是的,可能是。实际上,我也期望RPC代码具有投射问题。它的生成。 – nisha 2010-10-21 08:47:14

回答

0

我认为中投的错误是不是在您发布的代码...

+0

是的,它指向这条线...... – nisha 2010-10-21 06:17:45

+0

ws.v1.tmf854.snc.http.GetAllExplicitPathsResponse是预期的返回类型getAllExplicitPaths() – nisha 2010-10-21 06:18:28

+0

你检查过你使用的库的版本吗?也许可能与一些JAR问题有关... – robob 2010-10-21 07:28:18