如何解决此PicasawebService错误?

时间:2009-08-01 02:01:04

标签: java google-app-engine picasa

我只是想让一些事情发挥作用,所以我可以尝试一些谷歌应用程序引擎java。但是我似乎遇到了一些我无法掌握的问题。

java代码如下所示:

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();
    }

}

}

我引用了mail.jar,activation.jar,servlet-api.jar,gdata-client,gdata-client-meta,gdata-core,gdata-media,gdata-photos-2.0.jar和gdata-photos -meta-2.0.jar根据google的指示。

我将此错误发送到控制台:

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)

关于我错过的任何想法?

2 个答案:

答案 0 :(得分:1)

您还需要Google Collections

答案 1 :(得分:0)

确认您没有加载两次google jars。有时你会有2个位置,而你没有想到的位置会丢失一个罐子。然后你的类文件丢失,因为它所在的jar不在第一个类加载器下。当您在webapp的WEB-INF / lib中拥有所有jar,但Tomcat / lib中的一些jar时,通常会在Tomcat上发生这种情况。或者,我只在google-collect.jar中找到了缺失的课程,我认为你没有列出它

相关问题