Hello, I'm really at loss trying to track down the source of this exception:
Apr 19, 2011 11:53:47 AM com.google.apphosting.utils.jetty.JettyLogger warn WARNING: /_ah/login java.lang.NullPointerException at com.google.appengine.api.users.dev.LoginCookieUtils.encodeEmailAsUserId(LoginCookieUtils.java: 89) at com.google.appengine.api.users.dev.LoginCookieUtils.createCookie(LoginCookieUtils.java: 41) at com.google.appengine.api.users.dev.LocalLoginServlet.doPost(LocalLoginServlet.java: 90) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java: 511) at org.mortbay.jetty.servlet.ServletHandler $CachedChain.doFilter(ServletHandler.java:1166) 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 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) This is occurring on my development server after running the app as a Web Application through eclipse. The app basically stores .html files in the blobstore, and allows the user to edit the html file through a small jQuery based HTML editor. I can retrieve the .html file contents from the blobstore using fetchData to return a byte array of the contents. But once the user has made changes to the html code via the editor, I'm trying to update the entry in the DATASTORE that references the BlobKey string for the corresponding .html file. So I am using a MultiPartFormOutputStream to write directly to the request headers and simulate an HTTP POST request. Here is the code I have: byte[] htmlData = content.getBytes(); for(int k=0; k<htmlData.length; k++) { resp.getWriter().println("Byte " + k + ": " + htmlData[k]); } BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); String uploadURL = blobstoreService.createUploadUrl("/upload"); //add host if in dev mode if(uploadURL.indexOf("http") == -1) { uploadURL = "http://localhost:8888" + uploadURL; } URL url = new URL(uploadURL); // create a boundary string String boundary = MultiPartFormOutputStream.createBoundary(); URLConnection urlConn = MultiPartFormOutputStream.createConnection(url); urlConn.setReadTimeout(15000); urlConn.setRequestProperty("Accept", "*/*"); urlConn.setRequestProperty("Content-Type", MultiPartFormOutputStream.getContentType(boundary)); // set some other request headers... urlConn.setRequestProperty("Connection", "Keep-Alive"); urlConn.setRequestProperty("Cache-Control", "no-cache"); // no need to connect because getOutputStream() does it MultiPartFormOutputStream out = new MultiPartFormOutputStream(urlConn.getOutputStream(), boundary); // write a text field element - This should be removed - left over from multipart library demo code out.writeField("old", oldBlobKey); out.writeField("lob", lineOfBusiness); out.writeField("topic", topic); out.writeField("category", category); out.writeField("key", key); // write bytes directly out.writeFile("myFile", "application/octet-stream", "content.html", htmlData); out.close(); // read response from server BufferedReader responseIn = new BufferedReader(new InputStreamReader(urlConn.getInputStream())); StringBuilder redirectResponse = new StringBuilder(); String line=""; while((line = responseIn.readLine()) != null) { redirectResponse.append(line); } resp.getWriter().println(redirectResponse); Essentially the user is directed to a servlet with this code upon clicking the Update button on the HTML editor. The POST data is then passed along via the MultiPartFormOutputStream to another servlet called Upload. Here is the code for Upload: public class Upload extends HttpServlet { private BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Map<String, BlobKey> blobs = blobstoreService.getUploadedBlobs(req); BlobKey blobKey = blobs.get("myFile"); String content = blobKey.getKeyString(); String oldKeyStr = req.getParameter("old"); BlobKey oldKey = new BlobKey(oldKeyStr); String lineOfBusiness = req.getParameter("lob"); String topic = req.getParameter("topic"); String category = req.getParameter("category"); Long key = Long.parseLong(req.getParameter("key")); //delete old blob blobstoreService.delete(oldKey); //First, grab the old object. PersistenceManager pm = PMF.get().getPersistenceManager(); Topic t = pm.getObjectById(Topic.class, key); t.setContent(content); t.setLineOfBusiness(lineOfBusiness); t.setTopic(topic); t.setCategory(category); try { pm.makePersistent(t); } finally { pm.close(); } res.sendRedirect("topics.jsp"); } } -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.