我只是开始学习,如何在Goole App Engine Standard中使用java。 我使用Eclipse 4.6.3来学习。 我创建了网络项目并编写了一些垃圾,然后我决定尝试在谷歌云存储中列出文件。 下面是我的代码。
public static ArrayList<String> getFilesInBucket(String bucket_name)
/*Line 235*/GcsService gcsService = GcsServiceFactory.createGcsService(RetryParams.getDefaultInstance());
ListResult result = null;
try { result = gcsService.list(bucket_name, ListOptions.DEFAULT); }
catch (IOException e)
// TODO Auto-generated catch block
e.printStackTrace();
ArrayList<String> files = new ArrayList<String>();
while (result.hasNext())
ListItem l = result.next();
if (!l.isDirectory())
files.add(l.getName());
return files;
这个垃圾在本地可以工作,但在我部署之后就停止了。我在Google Console中看到了错误。
java.lang.NoClassDefFoundError: com/google/api/client/http/HttpRequestInitializer
at MyJunk.getFilesInBucket (ADServlet.java:235)
每一个被添加到src的lib目录下的jar也被添加到web-inf/lib中。
我也在这里添加了这个jar。
我甚至打开了问题选项卡,快速修复了每个 "Eclipse警告。XXXXXXX.jar 将不会被导出或发布。"的垃圾。
(这不是我的屏幕)。
而我的代码在GAE标准版上运行时却失败了......我还能做些什么来解决这个问题?