简体   繁体   中英

Google Blobstore App Engine tutorial

Update see below

I'm trying to build this blobstore app engine sample from this google tutorial:

https://developers.google.com/appengine/docs/java/blobstore/#Uploading_a_Blob

This is what I have. I can select a file to upload.

http://instantedituploader.appspot.com/

When I hit submit I get this error:

    Error: Not Found

    The requested URL /%3C%=%20blobstoreService.createUploadUrl(?foo=&myFile=sprayerpic.jpg was not found on this server.

I'm fairly certain I'm missing:

<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %>

<%
BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
%>

I took it out because I couldn't figure out how to include that in the index.html. The tutorial uses a jsp file to include the above and the html for the upload form/submit. How do I do this?

UPDATE----------------------

Ok I switched the index.jsp to my welcome file. Now I get a 500 Server Error this is what shows up in the app engine console and I also get a /favicon.ico error too.

013-09-18 08:33:08.601 / 500 3477ms 0kb Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko) Ubuntu/12.10 Chromium/22.0.1229.94 Chrome/22.0.1229.94 Safari/537.4
W 2013-09-18 08:33:08.412 EXCEPTION java.lang.ClassNotFoundException: Serve at com.google.appengine.runtime.Request.process-cb1588546d641fbb(Request.java) at java.lang.Class
E 2013-09-18 08:33:08.414 javax.servlet.ServletContext log: unavailable javax.servlet.UnavailableException: Serve at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:79)
W 2013-09-18 08:33:08.419 EXCEPTION java.lang.ClassNotFoundException: Upload at com.google.appengine.runtime.Request.process-cb1588546d641fbb(Request.java) at java.lang.Clas
E 2013-09-18 08:33:08.420 javax.servlet.ServletContext log: unavailable javax.servlet.UnavailableException: Upload at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:79)
W 2013-09-18 08:33:08.591 Failed startup of context com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@d206ca{/,/base/data/home/apps/s~instantedituploader/1.370311
C 2013-09-18 08:33:08.597 Uncaught exception from servlet javax.servlet.UnavailableException: Initialization failed. at com.google.apphosting.runtime.jetty.AppVersionHandlerMa
I 2013-09-18 08:33:08.600 This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This requ

The files in the example are Java Server Pages. See the docs on how to use JSPs with GAE .

You should rename index.html to index.jsp and set it as a welcome file in your web.xml (welcome page is served when user invokes the root / ):

<welcome-file-list>
    <welcome-file>path/to/index.jsp</welcome-file>
</welcome-file-list>

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