Search code examples
javagoogle-app-enginepicasa

How can I solve this PicasawebService error?


I am just trying to get some things to work so I can try some of google app engines java. However I seem to have a problem with something that I can't get a hold of.

The java code looks like this:

import java.net.URL;
import com.google.gdata.client.photos.*;
import com.google.gdata.data.photos.*;

public class TestPicasa {

public static void main(String[] args) {

    try {
        PicasawebService service = new PicasawebService("Picasa test");
        service.setUserCredentials("username@gmail.com", "password");
        URL feedURL = new URL("http://picasaweb.google.com/data/feed/api/user/username?kind=album");
        UserFeed feed = service.getFeed(feedURL, UserFeed.class);
        for (AlbumEntry entry : feed.getAlbumEntries()) {
             System.out.println(entry.getTitle().getPlainText());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

}

I have referenced to mail.jar, activation.jar, servlet-api.jar, gdata-client, gdata-client-meta, gdata-core, gdata-media, gdata-photos-2.0.jar and gdata-photos-meta-2.0.jar according to instruction from google.

And I get this error to the console:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:118)
at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:100)
at com.google.gdata.client.Service.<clinit>(Service.java:532)
at TestPicasa.main(TestPicasa.java:10)

Any idea on what I have missed?


Solution

  • You also need Google Collections