Create PicasawebService

谁说我不能喝 提交于 2019-12-24 10:59:15

问题


I try to get the titles and URLs from a public Picasa album. But I am stuck at the very beginning: I cannot create a new PicasawebService.

My Code:

import java.util.List;
import java.io.File;
import java.net.URL;

import com.google.gdata.client.*;
import com.google.gdata.client.photos.*;
import com.google.gdata.data.*;
import com.google.gdata.data.media.*;
import com.google.gdata.data.photos.*;
import java.util.ArrayList;

public class PicasaManager implements PicasaConnector {

    public List<Avatar> getPhotoURLs() throws Exception {
        PicasawebService myService = new PicasawebService("HI");

        myService.setUserCredentials("foo@gmail.com", "mypassword");

        ArrayList<Avatar> rl = new ArrayList<Avatar>();

        URL feedUrl = new URL("https://picasaweb.google.com/111420671758947023853/EWA2012");
        System.out.println("dddddddddddddddddd");
        AlbumFeed feed = myService.getFeed(feedUrl, AlbumFeed.class);

        for (PhotoEntry photo : feed.getPhotoEntries()) {
            Avatar a1 = new Avatar();
            a1.setDescription(photo.getTitle().getPlainText());
            a1.setUrl(photo.getMediaThumbnails().get(0).getUrl());
            rl.add(a1);
        }

        return (rl);
    }
}

The Error Message:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;
    at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399)
    at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387)
    at com.google.gdata.wireformats.AltFormat.<clinit>(AltFormat.java:49)
    at com.google.gdata.client.Service.<clinit>(Service.java:558)
    at tuwien.big.mensch.utilities.PicasaManager.getPhotoURLs(PicasaManager.java:27)
    at tuwien.big.mensch.utilities.test.main(test.java:29)
  • test.java is my test class with the public static void main method,
  • Avatar is a class with two variables: description and url, there are getters and setters for both
  • in my netbeans IDE line 27 of the PicasaManager.java file is: PicasawebService myService = new PicasawebService("HI");
  • the implemented interace only defines the getPhotoURLs() method

I have no idea how to solve this problem, i hope somebody here can help me.


回答1:


Have you included gdata-core-1.0.jar and guava-12.0.jar? Good luck on the rest of Web Engineering UE4 ;-)



来源:https://stackoverflow.com/questions/10617386/create-picasawebservice

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!