简体   繁体   中英

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

I am trying to simply rename cloud storage file on app engine.

During the execution, it returns these errors:

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) at com.GAEApplication.GAEApplicationServlet.doGet(GAEApplicationServlet.java:28) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

The Error code lines are :

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

jars i have included are :

  1. appengine-api-1.0-sdk-1.9.34.jar
  2. appengine-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

how to solve this problem.

The easiest solution is to use Maven and import the App Engine Client For Google Cloud Storage . If Maven is not an option, here is a screenshot of what Maven downloaded for me:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM