[java jumblr client] error while executing example code

241 views
Skip to first unread message

Pasquale Franzese

unread,
May 8, 2013, 8:14:38 AM5/8/13
to Tumblr API Discussion
Hi, I'm new to the environment and I'm trying to run the example code
of jumbrl.

the code is:

package tumblr;
import com.tumblr.jumblr.*;
import com.tumblr.jumblr.types.Blog;
import com.tumblr.jumblr.types.User;
/**
*
* @author Pask
*/
public class Tumblr {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
JumblrClient client = new JumblrClient([oauth key], [oauth
secret] );
client.setToken([oauth token], [oauth token secret]);

// Write the user's name
User user = client.user(); //<--error happens here
System.out.println(user.getName());

by running it i get the error:


Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
commons/codec/binary/Base64
at
org.scribe.services.HMACSha1SignatureService.doSign(HMACSha1SignatureService.java:
47)
at
org.scribe.services.HMACSha1SignatureService.getSignature(HMACSha1SignatureService.java:
33)
at
org.scribe.oauth.OAuth10aServiceImpl.getSignature(OAuth10aServiceImpl.java:
99)
at
org.scribe.oauth.OAuth10aServiceImpl.addOAuthParams(OAuth10aServiceImpl.java:
53)
at
org.scribe.oauth.OAuth10aServiceImpl.signRequest(OAuth10aServiceImpl.java:
76)
at com.tumblr.jumblr.request.RequestBuilder.sign(RequestBuilder.java:
126)
at com.tumblr.jumblr.request.RequestBuilder.get(RequestBuilder.java:
68)
at com.tumblr.jumblr.JumblrClient.user(JumblrClient.java:64)
at tumblr.Tumblr.main(Tumblr.java:23)
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.codec.binary.Base64
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 9 more
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

I don't really know what I'm doing wrong, I got the codes with the
procedure described here:
https://groups.google.com/group/tumblr-api/browse_thread/thread/2c857d17c8868159

John Crepezzi

unread,
May 8, 2013, 8:40:18 AM5/8/13
to tumbl...@googlegroups.com
Sounds like you don't have the commons-codec dependency.
Are you using maven?



--
You received this message because you are subscribed to the Google Groups "Tumblr API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tumblr-api+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Pasquale Franzese

unread,
May 8, 2013, 8:46:10 AM5/8/13
to Tumblr API Discussion
I don't even know what that is... :(

On 8 Mag, 14:40, John Crepezzi <j...@tumblr.com> wrote:
> Sounds like you don't have the commons-codec dependency.
> Are you using maven?
>
> >https://groups.google.com/group/tumblr-api/browse_thread/thread/2c857...
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Tumblr API Discussion" group.
> > To unsubscribe from this group and stop receiving emails from it, send an> email totumblr-api...@googlegroups.com.
> > For more options, visithttps://groups.google.com/groups/opt_out.

John Crepezzi

unread,
May 8, 2013, 9:30:52 AM5/8/13
to tumbl...@googlegroups.com
In this respect, it would be a way to automatically download Jumblr's dependencies, but
if you're not using it - you can still download the dependency JARs and link them into your project (which should solve your issue):

They are:

* Scribe - org.scribe.scribe - v1.3.3 preferably
* GSON - com.google.code.gson - v2.2.2 preferably
* Apache Commons-Lang - org.apache.commons.commons-lang3 - 3.1 preferably


Pasquale Franzese

unread,
May 8, 2013, 9:49:06 AM5/8/13
to Tumblr API Discussion
thank you again for the reply, i downloaded:

scribe from here:
http://mvnrepository.com/artifact/org.scribe/scribe/1.3.3

gson from here:
http://mvnrepository.com/artifact/com.google.code.gson/gson/2.2.2

apache commons lang from here:
http://www.jarvana.com/jarvana/archive-details/org/apache/commons/commons-lang3/3.0.1/commons-lang3-3.0.1.jar

and imported all as jars into libs, still I got the same error D:

On 8 Mag, 15:30, John Crepezzi <j...@tumblr.com> wrote:
> In this respect, it would be a way to automatically download Jumblr's
> dependencies, but
> if you're not using it - you can still download the dependency JARs and
> link them into your project (which should solve your issue):
>
> They are:
>
> ** Scribe* - org.scribe.scribe - v1.3.3 preferably
> ** GSON* - com.google.code.gson - v2.2.2 preferably
> ** Apache Commons-Lang *- org.apache.commons.commons-lang3- 3.1 preferably
> > > > To unsubscribe from this group and stop receiving emails from it, send> an> emailtotumblr-...@googlegroups.com.

John Crepezzi

unread,
May 8, 2013, 10:28:03 AM5/8/13
to tumbl...@googlegroups.com
sorry, since you're not using maven you'll also need to download the dependencies listed for each of those projects
for example, this error indicates that scribe depends on commons-codec


Reply all
Reply to author
Forward
0 new messages