jTwitter、oAuth 和 Google App Engine。没有发现类定义错误

发布于 2024-09-18 09:02:28 字数 878 浏览 4 评论 0原文

我正在尝试使用 jTwitter 获取一个 oauth 实例,以使用我的消费者密钥/秘密和访问令牌/秘密进行 Twitter 发布。 此处对此进行了详细记录。我已经下载了路标、路标码头和 jtwitter 库,但在部署并运行 servlet 后,出现错误 java.lang.NoClassDefFoundError: Winterwell/jtwitter/OAuthSignpostClient Eclipse 不会抱怨类不在那里,因为它在那里——我可以在我的项目中的 JAR 文件本身中看到它。所以,我说算了,我会尝试 OAuthScribeClient< /a> 相反,但这生成了一个非常相似的错误 java.lang.NoClassDefFoundError: org/scribe/oauth/Token 这让我更加困惑,因为我的 java 文件中有以下代码,并且它编译时没有错误或警告:

import org.scribe.oauth.Token;
Token token = new Token("myaccesstokeninfo", "accesstokensecret");

显然,我错过了一些非常基本的东西,但我完全不知道它可能是什么。谢谢。

I'm trying to use jTwitter to get an oauth instance to twitter with my consumer key/secret and access token/secret. This is well documented in the javadoc here. I have downloaded signpost, signpost-jetty, and the jtwitter library, but after deploying and running the servlet, I get a error java.lang.NoClassDefFoundError: winterwell/jtwitter/OAuthSignpostClient Eclipse isn't complaining about the class not being there, because it is there-- I can see it in the JAR file itself, which is in my project. So, I said forget it, I'll try out OAuthScribeClient instead, but this generated a VERY SIMILAR ERROR java.lang.NoClassDefFoundError: org/scribe/oauth/Token This one confuses me even further because I have the following code in my java file, and it compiles without error or warning:

import org.scribe.oauth.Token;
Token token = new Token("myaccesstokeninfo", "accesstokensecret");

Clearly, I'm missing something very fundamental, but I am at an absolute loss as to what it may be. Thanks.

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

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

发布评论

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

评论(3

对岸观火 2024-09-25 09:02:28

通常,当您忘记将所有 jar 文件复制到“/war/WEB-INF/lib”目录时,会发生“NoClassDefFoundError”,因此这些库将无法从服务器端获得。

Usually "NoClassDefFoundError" happens when you forget to copy all jar-files to your "/war/WEB-INF/lib" directory, so those libs will be unavailable from server-side.

网名女生简单气质 2024-09-25 09:02:28

Xo4yHaMope 可能是对的。

如果您在 Eclipse 中工作但使用 Web 容器运行,那么您的运行时类路径可能与项目类路径不同 - 这可能会导致此错误。

Xo4yHaMope is probably right.

If you're working from Eclipse but running using a web container, then your runtime classpath might be different from your project classpath - which can cause this error.

野却迷人 2024-09-25 09:02:28

为了完成本·温特斯的回答,我实际上所做的和工作的是将罐子添加到
项目中的 libs 文件夹

另请参阅此处了解文件夹层次结构。

当您执行此操作时,Eclipse 通常会在启动应用程序之前将 jar 添加到 android 依赖项中。我意识到,在构建路径中添加 jar 将使类仅在构建期间可用

In order to complete Ben Winters answer what I actually did and worked is add the jar in
the libs folder within the project

see also here about folder hierarchy.

When you do this eclipse will normally add the jar to the android dependencies before launching the application. What I realise is that adding a jar in the build path will make classes available only during the build

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