views:

141

answers:

2

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.

+1  A: 

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.

Xo4yHaMope
A: 

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.

Ben Winters