[google-appengine] Re: unzipping images into blobstore
i tried with smaller chunks too (1024b), but this didn't help. meanwhile i wrote some work-around that seems to work, but still, i don't understand why the solution above does not. int read; ByteArrayOutputStream baos = new ByteArrayOutputStream(); while((read = zis.read()) >= 0) { baos.write(read); if(baos.size() == BlobstoreService.MAX_BLOB_FETCH_SIZE) { ByteBuffer bb = ByteBuffer.wrap(baos.toByteArray()); writeChannel.write(bb); baos = new ByteArrayOutputStream(); } } if(baos.size() > 0) { ByteBuffer bb = ByteBuffer.wrap(baos.toByteArray()); writeChannel.write(bb); } -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] unzipping images into blobstore
in my app i need to do the following: 1. a zip file with images (jpgs only right now)and other stuff is uploaded into the BlobStore. 2. an app engine backend should read the entries from the uploaded zip and save all images found inside to the BlobStore as stand alone files. i successfully upload, unzip and save files @ blobstore, but the images seem to be broken. when i download them from the BlobStore (simply blobstoreService.serve them) the images have wrong colors, or displayed partially, or broken in other ways. an attempt to use ImagesService also throws an exception. i checked the size of the images before they are zipped and the size of the files unzipped while written into the blobstore and they look the same. here is my code: ZipInputStream zis = ...; ZipEntry entry; while ((entry =zis.getNextEntry()) !=null) { String fileName = entry.getName().toLowerCase(); if(fileName.indexOf(".jpg") != -1 || fileName.indexOf(".jpeg") != -1) { FileService fileService = FileServiceFactory.getFileService(); String mime = ctx.getMimeType(fileName);//getting mime from servlet context AppEngineFile file = fileService.createNewBlobFile(mime, fileName); boolean lock = true; FileWriteChannel writeChannel = fileService.openWriteChannel(file, lock); byte[] buffer = new byte[BlobstoreService.MAX_BLOB_FETCH_SIZE]; while(zis.read(buffer) >= 0) { ByteBuffer bb = ByteBuffer.wrap(buffer); writeChannel.write(bb); } writeChannel.closeFinally(); BlobKey coverKey = fileService.getBlobKey(file); } } thanks a lot for you time! -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: errors while calling backends
ok, i succeeded to download the code from a backend. comparing it with what i've downloaded from a frontend i see that it misses the /lib folder with all jars under web-inf and non-xml application specific files placed under web-inf are not there too. i use intellij plugin to upload the frontend (works ok) and appcfg to upload backend (misses files). i tried to copy the /lib folder manually into the folder i upload from, but then i get errors from appcfg. any thoughts? On Nov 9, 10:12 am, atarno wrote: > what can be a reason for backends not to recognize the servlets mapped > in web.xml? > although, is there any way to use appcfg to download the code from the > backend? this seems to be the only way for me to know what my backend > "sees". > > On Nov 8, 5:35 pm, atarno wrote: > > > > > > > > > hi again, > > > i'm still fighting the backends.:) > > > i have some backend instances i try to call from the front end via > > task queue. > > i see in logs that the task is successfully created and the backend is > > called, but on the beckend side i always left with the following: > > > /_ah/start 500 979ms 0kb instance=1 > > > 0.1.0.3 - - [08/Nov/2011:07:15:12 -0800] "GET /_ah/start HTTP/1.1" 500 > > 0 - - "1.sync-be.zmsg-mobi.appspot.com" ms=979 cpu_ms=427 api_cpu_ms=0 > > cpm_usd=0.18 loading_request=1 exit_code=111 instance=5 > > > following by this exception for each and every servlet i have in my > > application: > > > W 2011-11-08 17:15:12.682 EXCEPTION > > java.lang.ClassNotFoundException: com.xxx.yyy.TestServlet > > at > > com.google.appengine.runtime.Request.process-(Request.java) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:266) > > at org.mortbay.util.Loader.loadClass(Loader.java:91) > > at org.mortbay.util.Loader.loadClass(Loader.java:71) > > at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73) > > at > > org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java: > > 242) > > at > > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: > > 50) > > at > > org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java: > > 685) > > at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) > > at > > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java: > > 1250) > > at > > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java: > > 517) > > at > > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java: > > 467) > > at > > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: > > 50) > > at com.google.tracing.TraceContext > > $TraceContextRunnable.runInContext(TraceContext.java:449) > > at com.google.tracing.TraceContext$TraceContextRunnable > > $1.run(TraceContext.java:455) > > at com.google.tracing.TraceContext.runInContext(TraceContext.java: > > 695) > > at com.google.tracing.TraceContext > > $AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java: > > 333) > > at com.google.tracing.TraceContext > > $AbstractTraceContextCallback.runInInheritedContext(TraceContext.java: > > 325) > > at com.google.tracing.TraceContext > > $TraceContextRunnable.run(TraceContext.java:453) > > at java.lang.Thread.run(Thread.java:679) > > > turning into this great stuff, again as a number of servlets i have: > > > Failed startup of context > > com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@1bbc779{/,/ > > base/data/home/apps/s~zmsg-mobi/sync-be.354538568494127495} > > org.mortbay.util.MultiException[java.lang.NullPointerException, > > java.lang.NullPointerException, java.lang.NullPointerException, > > java.lang.NullPointerException, java.lang.NullPointerException, > > java.lang.NullPointerException, java.lang.NullPointerException, > > java.lang.NullPointerException] > > at > > org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java: > > 656) > > at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) > > at > > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java: > > 1250) > > at > > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java: > > 517) > > at > > org.mortbay.jetty.webapp.WebAppContext.do
[google-appengine] Re: errors while calling backends
what can be a reason for backends not to recognize the servlets mapped in web.xml? although, is there any way to use appcfg to download the code from the backend? this seems to be the only way for me to know what my backend "sees". On Nov 8, 5:35 pm, atarno wrote: > hi again, > > i'm still fighting the backends.:) > > i have some backend instances i try to call from the front end via > task queue. > i see in logs that the task is successfully created and the backend is > called, but on the beckend side i always left with the following: > > /_ah/start 500 979ms 0kb instance=1 > > 0.1.0.3 - - [08/Nov/2011:07:15:12 -0800] "GET /_ah/start HTTP/1.1" 500 > 0 - - "1.sync-be.zmsg-mobi.appspot.com" ms=979 cpu_ms=427 api_cpu_ms=0 > cpm_usd=0.18 loading_request=1 exit_code=111 instance=5 > > following by this exception for each and every servlet i have in my > application: > > W 2011-11-08 17:15:12.682 EXCEPTION > java.lang.ClassNotFoundException: com.xxx.yyy.TestServlet > at > com.google.appengine.runtime.Request.process-(Request.java) > at java.lang.ClassLoader.loadClass(ClassLoader.java:266) > at org.mortbay.util.Loader.loadClass(Loader.java:91) > at org.mortbay.util.Loader.loadClass(Loader.java:71) > at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73) > at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java: > 242) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: > 50) > at > org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java: > 685) > at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) > at > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java: > 1250) > at > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java: > 517) > at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java: > 467) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: > 50) > at com.google.tracing.TraceContext > $TraceContextRunnable.runInContext(TraceContext.java:449) > at com.google.tracing.TraceContext$TraceContextRunnable > $1.run(TraceContext.java:455) > at com.google.tracing.TraceContext.runInContext(TraceContext.java: > 695) > at com.google.tracing.TraceContext > $AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java: > 333) > at com.google.tracing.TraceContext > $AbstractTraceContextCallback.runInInheritedContext(TraceContext.java: > 325) > at com.google.tracing.TraceContext > $TraceContextRunnable.run(TraceContext.java:453) > at java.lang.Thread.run(Thread.java:679) > > turning into this great stuff, again as a number of servlets i have: > > Failed startup of context > com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@1bbc779{/,/ > base/data/home/apps/s~zmsg-mobi/sync-be.354538568494127495} > org.mortbay.util.MultiException[java.lang.NullPointerException, > java.lang.NullPointerException, java.lang.NullPointerException, > java.lang.NullPointerException, java.lang.NullPointerException, > java.lang.NullPointerException, java.lang.NullPointerException, > java.lang.NullPointerException] > at > org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java: > 656) > at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) > at > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java: > 1250) > at > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java: > 517) > at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java: > 467) > at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: > 50) > at > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java: > 202) > at > com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java: > 171) > at > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java: > 123) > at com.google.apphosting.runtime.JavaRuntime > $RequestRunnable.run(JavaRuntime.java:392) > at com.google.tracing.TraceContext > $TraceContextRunnable.runInContext(TraceContext.java:449) > at com.google.tracing.TraceContext$TraceContextRunnable > $1.run(TraceContext.java:455) > at com.google.tracing.TraceContext.runInContext(TraceContext.java: > 695) > at com.google.tracing.TraceContext > $AbstractTr
[google-appengine] errors while calling backends
hi again, i'm still fighting the backends.:) i have some backend instances i try to call from the front end via task queue. i see in logs that the task is successfully created and the backend is called, but on the beckend side i always left with the following: /_ah/start 500 979ms 0kb instance=1 0.1.0.3 - - [08/Nov/2011:07:15:12 -0800] "GET /_ah/start HTTP/1.1" 500 0 - - "1.sync-be.zmsg-mobi.appspot.com" ms=979 cpu_ms=427 api_cpu_ms=0 cpm_usd=0.18 loading_request=1 exit_code=111 instance=5 following by this exception for each and every servlet i have in my application: W 2011-11-08 17:15:12.682 EXCEPTION java.lang.ClassNotFoundException: com.xxx.yyy.TestServlet at com.google.appengine.runtime.Request.process-(Request.java) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at org.mortbay.util.Loader.loadClass(Loader.java:91) at org.mortbay.util.Loader.loadClass(Loader.java:71) at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73) at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java: 242) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: 50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java: 685) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java: 1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java: 517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java: 467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: 50) at com.google.tracing.TraceContext $TraceContextRunnable.runInContext(TraceContext.java:449) at com.google.tracing.TraceContext$TraceContextRunnable $1.run(TraceContext.java:455) at com.google.tracing.TraceContext.runInContext(TraceContext.java: 695) at com.google.tracing.TraceContext $AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java: 333) at com.google.tracing.TraceContext $AbstractTraceContextCallback.runInInheritedContext(TraceContext.java: 325) at com.google.tracing.TraceContext $TraceContextRunnable.run(TraceContext.java:453) at java.lang.Thread.run(Thread.java:679) turning into this great stuff, again as a number of servlets i have: Failed startup of context com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@1bbc779{/,/ base/data/home/apps/s~zmsg-mobi/sync-be.354538568494127495} org.mortbay.util.MultiException[java.lang.NullPointerException, java.lang.NullPointerException, java.lang.NullPointerException, java.lang.NullPointerException, java.lang.NullPointerException, java.lang.NullPointerException, java.lang.NullPointerException, java.lang.NullPointerException] at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java: 656) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java: 1250) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java: 517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java: 467) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java: 50) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java: 202) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java: 171) at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java: 123) at com.google.apphosting.runtime.JavaRuntime $RequestRunnable.run(JavaRuntime.java:392) at com.google.tracing.TraceContext $TraceContextRunnable.runInContext(TraceContext.java:449) at com.google.tracing.TraceContext$TraceContextRunnable $1.run(TraceContext.java:455) at com.google.tracing.TraceContext.runInContext(TraceContext.java: 695) at com.google.tracing.TraceContext $AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java: 333) at com.google.tracing.TraceContext $AbstractTraceContextCallback.runInInheritedContext(TraceContext.java: 325) at com.google.tracing.TraceContext $TraceContextRunnable.run(TraceContext.java:453) at com.google.apphosting.runtime.ThreadGroupPool $PoolEntry.run(ThreadGroupPool.java:162) at java.lang.Thread.run(Thread.java:679) what say you? -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Backends clarification
hi folks, i am afraid i misunderstand the concept of backends' pricing and need your help with this. as far as i understood, backends' pricing is done per hour per instance. for test purposes i created a b4 backend in my app. two instances have been loaded. after ~10 minutes i was out of promised free "9.00 Instance Hours" - red dashboard and no soup for me. what am i missing? thanks. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/CkQSkZ0aVgIJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: memcache distribution
thanks for your responses. as i understand there is no way to hold and change a distributable static variable in gae, but to persist it in the datastore on each change? -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/I6rG1WIcQFgJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: memcache distribution
bump sorry, but i'm still looking for an answer. i give this question another chance. thanks. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/zFTHJrYRhjoJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] memcache distribution
hi folks, i'm puzzled by memcache related logs i see and need your advice. i'm running a java app. i use memcache as a holder of some static variables accessed and changed by different modules. i do it, because as far as i understand such changes will apply to all distributed application instances. the initialization of the memcache is done within an init() method of a servlet flagged with . i have a following piece of code there: if(CacheManager.getInstance().getCache("static_vars") == null) { CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory(); Cache cache = cacheFactory.createCache(Collections.emptyMap()); CacheManager.getInstance().registerCache("static_vars", cache); cache.put("var1", 0); cache.put("var2", 9302); . } now, i'm watching the logs and i see two requests arriving within 2 seconds. the first one targets an existing instance and everything goes as expected, but the second one triggers a creation of new servlet instance that loads the cache. i guess it happens because another application instance is created. the problem is that i see that in this new instance CacheManager.getInstance().getCache("static_vars") == null. the new instance does not recognize that a memcache with this name already exists and therefore does not use the values that were set there by first instance. what's my problem here? thanks in advance. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/sjMKymw8h7sJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.