【问题标题】:NoSuchMethod exception thrown in GWTGWT 中抛出 NoSuchMethod 异常
【发布时间】:2010-06-11 15:08:14
【问题描述】:

我开始在 OS X 10.5.8 上使用 Eclipse 插件了解最新的 Google Web Toolkit。到目前为止,我已经能够让客户端启动并运行,这很棒。

但是,服务器是另一回事。我正在尝试链接到一个 .jar 文件,该文件有一些我想在服务器 ServiceImpl 类中使用的类,但它似乎已经融入了 .jar 的先前迭代 - 我添加了一个方法,重建了 jar ,从 GWT 项目的构建路径(以及导出)上的库选项卡中删除 jar 并重新包含该 jar。没有运气 - 我仍然得到:

[WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract org.gwtapplication.client.LWDocument org.gwtapplication.client.DocumentService.getDocument()' threw an unexpected exception: java.lang.NoSuchMethodError: org.externalmodel.MyReallyValidClass.toSomething()Ljava/lang/String;
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:581)
...
Caused by: java.lang.NoSuchMethodError: org.externalmodel.MyReallyValidClass.toSomething()Ljava/lang/String;
at org.application.server.DocumentServiceImpl.getDocument(DocumentServiceImpl.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

Eclipse 的代码感知在解析 MyReallyValidClass.toSomething() 调用时没有问题,并且对 externalmodel 类的其他调用也没有错误。有什么线索我应该去哪里看吗?

【问题讨论】:

    标签: gwt nosuchmethoderror


    【解决方案1】:

    在您的 DocumentServiceImpl 类中,添加以下日志:

    System.out.println(Thread.currentThread().getContextClassLoader().getResource("org/externalmodel/MyReallyValidClass.class");
    

    应该告诉你这个罐子是从哪里捡来的。

    【讨论】:

    • 完美!在 war/WEB_INF/lib 目录中有我的 .JAR 的旧副本。删除它就可以了。谢谢!
    • 我有一个类似的问题,在清除gwt-unitCache/%TEMP%/gwt* 后就消失了(详情请参阅GWT issue)。
    猜你喜欢
    • 2020-12-06
    • 1970-01-01
    • 2021-09-02
    • 1970-01-01
    • 2022-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多