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 :
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.