GWT 中引发 NoSuchMethod 异常

发布于 2024-09-05 04:58:32 字数 1247 浏览 1 评论 0原文

我开始在 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() 调用时没有问题,并且对外部模型类的其他调用也没有错误。有什么线索我应该去哪里寻找吗?

I'm starting to get my feet wet in the latest Google Web Toolkit using the Eclipse plugin on OS X 10.5.8. So far I've been able to get the client up and running, which is great.

The server, though, is a different matter. I'm trying to link to a .jar file that has some classes I want to use in a server ServiceImpl class, but it seems to have glommed onto a previous iteration of the .jar - I've added a method, rebuilt the jar, removed the jar from the libraries tab on the GWT project's build path (as well as on the exports) and reincluded the jar. No luck - I'm still getting:

[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's code sense has no problems resolving the MyReallyValidClass.toSomething() call, and there are no errors with other calls into the externalmodel classes. Any clue where I should be looking?

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

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

发布评论

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

评论(1

沫离伤花 2024-09-12 04:58:42

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

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

应该告诉您在哪里拾取此 jar。

In your DocumentServiceImpl class, adding the following log:

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

should tell you where this jar is being picked up.

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