I am attempt to use the Blobstore api for appengine using GWT... I promise you! I had it working for months and suddenly I started get the following errors.. arfter executing the following line from a servelet.
public class ImageServiceImpl extends RemoteServiceServlet implements ImageService {
/**
*
*/
private static final long serialVersionUID = 1L;
// init the blog store service
private BlobstoreService blobService = BlobstoreServiceFactory.getBlobstoreService();
//private static final Logger log = Logger.getLogger(ImageServiceImpl.class);
public static final String PATH_TO_DEFAULT_IMAGE = "images/no_photo.jpg";
. . . . . // omitted for brevity }
@Override
public String getUpLoadPath() {
String url = blobService.createUploadUrl("/n5/doimage");
return url;
}
}
Initializing App Engine server Sep 19, 2011 7:28:45 PM com.google.apphosting.utils.jetty.JettyLogger info INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger Sep 19, 2011 7:28:45 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml INFO: Successfully processed C:\development\n5\n5\war\WEB-INF/appengine-web.xml Sep 19, 2011 7:28:45 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml INFO: Successfully processed C:\development\n5\n5\war\WEB-INF/web.xml Sep 19, 2011 3:28:47 PM com.google.appengine.tools.development.DevAppServerImpl start INFO: The server is running at http://localhost:8888/ Sep 19, 2011 7:34:59 PM com.google.appengine.tools.development.ApiProxyLocalImpl log SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.six.n5.client.service.ImageService.getUpLoadPath()' threw an unexpected exception: java.lang.VerifyError: class com.google.appengine.api.blobstore.BlobstoreServicePb$CreateUploadURLRequest overrides final method isInitialized.()Z at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: java.lang.VerifyError: class com.google.appengine.api.blobstore.BlobstoreServicePb$CreateUploadURLRequest overrides final method isInitialized.()Z at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176) at java.lang.ClassLoader.loadClass(Unknown Source) at com.google.appengine.api.blobstore.BlobstoreServiceImpl.createUploadUrl(BlobstoreServiceImpl.java:43) at com.google.appengine.api.blobstore.BlobstoreServiceImpl.createUploadUrl(BlobstoreServiceImpl.java:34) at com.six.n5.server.ImageServiceImpl.getUpLoadPath(ImageServiceImpl.java:153) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569) ... 39 more
I found my own error! as it turn out the reason this was suddenly failing was because the FORM post thought it was cross domain posting. I was testing the web site by calling 127.0.0.1:8888..etc but when the when my Image RPC was called to establish the upload path, it returned to the form setAction the my machine name kmoore-PC:8888..etc instead of the 127.0.0.1:8888... and hence it returned null because it thought it was crossing domains.
To fix, click on the google box in url bar and add your computer name and then test you app using the computer name instead of 127
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With