java.lang.NoClassDefFoundError:com / google / appengine / tools / cloudstorage / GcsFilename

时间:2017-07-11 11:07:25

标签: java google-app-engine jar

我想简单地在app引擎上重命名云存储文件。

在执行期间,它会返回以下错误:

java.lang.NoClassDefFoundError:com / google / appengine / tools / cloudstorage / gcsFilename at com.GAEApplication.GAEApplicationServlet.loadFile(GAEApplicationServlet.java:40)         at com.GAEApplication.GAEApplicationServlet.moveFile(GAEApplicationServlet.java:33)         在com.GAEApplication.GAEApplicationServlet.doGet(GAEApplicationServlet.java:28)         在javax.servlet.http.HttpServlet.service(HttpServlet.java:617)         在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)         在org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

错误代码行是:

private byte[] loadFile(String bucket, String fileName) throws IOException {

        GcsFilename gcsFileName = new GcsFilename(bucket, fileName);
         GcsService gcsService = GcsServiceFactory.createGcsService();
            GcsInputChannel readChannel = gcsService.openReadChannel(gcsFileName, 0);
            InputStream in = newInputStream(readChannel);
            return IOUtils.toByteArray(in);
    }
我包括的罐子是:

  1. 应用服务引擎的API-1.0-SDK-1.9.34.jar
  2. 应用服务引擎的API-labs.jar
  3. appengine-endpoints-deps.jar appengine-endpoints.jar
  4. appengine-jsr107cache-1.9.34.jar asm-4.0.jar
  5. datanucleus-api-jdo-3.1.3.jar datanucleus-api-jpa-3.1.3.jar
  6. datanucleus-appengine-2.1.2.jar datanucleus-core-3.1.3.jar
  7. JTA-1.1.jar
  8. 如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

最简单的解决方案是使用Maven并导入App Engine Client For Google Cloud Storage。如果Maven不是一个选项,这里是Maven为我下载的截图:

enter image description here