Google App Engine

Google App Engine Java Development

Maximum number of indexes allowed in app engine

clock October 29, 2009 19:22 by author jimbo

Google app engine support 100 indexes, if you go over this you will recieve a message similiar to the one below.  To remove indexes you'll have to use the python methods as Java removal is not supported yet.

Unable to upload:
java.io.IOException: Error posting to URL: http://appengine.google.com/api/datastore/index/add?app_id=appname&version=2&
400 Bad Request
Over index creation quota: The API call datastore_v3.CreateIndex() required more quota than is available.

 at com.google.appengine.tools.admin.ServerConnection.send(ServerConnection.java:143)
 at com.google.appengine.tools.admin.ServerConnection.post(ServerConnection.java:81)
 at com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.java:429)
 at com.google.appengine.tools.admin.AppVersionUpload.updateIndexes(AppVersionUpload.java:144)
 at com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java:120)
 at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:53)
 at com.google.appengine.tools.admin.AppCfg$UpdateAction.execute(AppCfg.java:504)
 at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:129)
 at com.google.appengine.tools.admin.AppCfg.<init>(AppCfg.java:57)
 at com.google.appengine.tools.admin.AppCfg.main(AppCfg.java:53)
com.google.appengine.tools.admin.AdminException: Unable to upload app: Error posting to URL: http://appengine.google.com/api/datastore/index/add?app_id=appname&version=2&
400 Bad Request
Over index creation quota:

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


javax.servlet.ServletException: java.lang.RuntimeException: java.io.InvalidClassException

clock October 28, 2009 20:33 by author john

The following exception bugged us for ages. Such a problem can happen sometimes if you modify a class and upload while you have a session already open. If you close your web browser and reopen the exception no longer appears.

Nested in javax.servlet.ServletException: java.lang.RuntimeException: java.io.InvalidClassException: bl.model.ApplicationVersionModel; local class incompatible: stream classdesc serialVersionUID = -5967725831600027098, local class serialVersionUID = 1733758913422926772:
java.lang.RuntimeException: java.io.InvalidClassException: bl.model.ApplicationVersionModel; local class incompatible: stream classdesc serialVersionUID = -5967725831600027098, local class serialVersionUID = 1733758913422926772
 at com.google.apphosting.runtime.jetty.SessionManager.deserialize(SessionManager.java:387)
 at com.google.apphosting.runtime.jetty.SessionManager.loadSession(SessionManager.java:307)
 at com.google.apphosting.runtime.jetty.SessionManager.getSession(SessionManager.java:282)
 at org.mortbay.jetty.servlet.AbstractSessionManager.getHttpSession(AbstractSessionManager.java:237)
 at org.mortbay.jetty.Request.getSession(Request.java:998)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:192)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
 at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:238)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
 at org.mortbay.jetty.Server.handle(Server.java:313)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
 at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
 at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
 at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:139)
 at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:239)
 at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5135)
 at com.google.apphosting.base.RuntimePb$EvaluationRuntime$6.handleBlockingRequest(RuntimePb.java:5133)
 at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:24)
 at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:363)
 at com.google.net.rpc.impl.Server$2.run(Server.java:814)
 at com.google.tracing.LocalTraceSpanRunnable.run(LocalTraceSpanRunnable.java:56)
 at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan(LocalTraceSpanBuilder.java:516)
 at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
 at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
 at com.google.net.rpc.impl.ServerConnection.messageReceived(ServerConnection.java:437)
 at com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:319)
 at com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:290)
 at com.google.net.async.Connection.handleReadEvent(Connection.java:436)
 at com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:762)
 at com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:207)
 at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
 at com.google.net.rpc.RpcService.runUntilServerShutdown(RpcService.java:251)
 at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run(JavaRuntime.java:396)
 at java.lang.Thread.run(Unknown Source)
Caused by: java.io.InvalidClassException: bl.model.ApplicationVersionModel; local class incompatible: stream classdesc serialVersionUID = -5967725831600027098, local class serialVersionUID = 1733758913422926772
 at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
 at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
 at java.io.ObjectInputStream.readClassDesc(Unknown Source)
 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
 at java.io.ObjectInputStream.readObject0(Unknown Source)
 at java.io.ObjectInputStream.readObject(Unknown Source)
 at java.util.HashMap.readObject(Unknown Source)
 at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
 at java.io.ObjectInputStream.readSerialData(Unknown Source)
 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
 at java.io.ObjectInputStream.readObject0(Unknown Source)
 at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
 at java.io.ObjectInputStream.readSerialData(Unknown Source)
 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
 at java.io.ObjectInputStream.readObject0(Unknown Source)
 at java.io.ObjectInputStream.readObject(Unknown Source)
 at com.google.apphosting.runtime.jetty.SessionManager.deserialize(SessionManager.java:385)
 ... 35 more

Currently rated 3.8 by 8 people

  • Currently 3.75/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


JDO Query Imports

clock September 3, 2009 22:22 by author jimbo

 If you create a query which uses util.Date or any other types which require an import, you have to declare the import/s using query.declareImports();

javax.jdo.JDOException: Class Date for query has not been resolved. Check the query and any imports specification
    at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:423)
    at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:275)

Currently rated 5.0 by 10 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Primitive types

clock September 3, 2009 22:18 by author jimbo

It is safer to use non primitive types in ds i.e. Boolean and not boolean.  The below message can occur as they are not allowed null values.

java.lang.NullPointerException: Datastore entity with kind Application and key Application(108) has a null property named update.  This property is mapped to ds.Application.update, which cannot accept null values.
    at org.datanucleus.store.appengine.DatastoreFieldManager.checkAssignmentToNotNullField(DatastoreFieldManager.java:388)
    at org.datanucleus.store.appengine.DatastoreFieldManager.fetchBooleanField(DatastoreFieldManager.java:416)
    at org.datanucleus.state.AbstractStateManager.replacingBooleanField(AbstractStateManager.java:1052)
    at ds.Application.jdoReplaceField(Application.java)
    at ds.Application.jdoReplaceFields(Application.java)
    at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2772)
    at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2791)
    at org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java:349)

 

 

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Boolean Class and Spring MVC Bug

clock September 1, 2009 12:33 by author john

The Boolean class, which you will need to use for your Google App Engine Data stores has a problem when it comes to the Spring MVC approach. The problem only occurs when you use the "is" method instead of the "get" method. When getting a normal boolean attribute you would usually use something like "isShowEnabledUsers" In Spring this produces the following exception in your JSP pages:

Invalid property 'showEnabledUsers' of bean class [bl.search.UserSearchModel]: 
Bean property 'showEnabledUsers' is not readable or has an invalid getter method: 
Does the return type of the getter match the parameter type of the setter?
org.springframework.beans.NotReadablePropertyException: Invalid property 'showEnabledUsers' of bean class [bl.search.UserSearchModel]: 

In order to get around this problem you simply need to use a "get" method instead. "isShowEnabledUsers" would therefore become "getShowEnabledUsers".

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


High CPU Cycles After Deployment

clock August 26, 2009 22:26 by author john

You often get high CPU cycle warnings in Google App Engine after deploying new versions of applications. Don't worry! This is completley normal and does not mean your app is too slow. Active applications are priorotised on App Engine, which is why your application will run slow at first. After deployment it is therefore a good idea to run a number of requests using your application. This will cause App Engine to distribute your app instance much quicker across multiple servers so that it will run much faster on subsequent requests.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Define a Favicon

clock August 26, 2009 22:19 by author john

Normaly you do not need to define a Favicon for web applications but when it comes to Google App Engine you really should do. If you don't define a favicon then every time a web browser issues a request for the favicon.ico file an error will be logged within GAE. If you don't define one you will have a large number of errors before long!

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Using Spring Tag Libs with Google App Engine

clock August 26, 2009 08:34 by author john

Using the following code in your JSP files does not work when using Spring tags on Google App Engine:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

Instead you need to ensure that isELIgnored is set to false in order to get Spring tags such as <spring:bind> to function correctly.

If you insert the following code then Spring tags will work correctly:

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Can I use springs @transactional function?

clock August 24, 2009 18:51 by author jimbo

Unfrotunatly springs @transactional will not work although it compiles without warning or error. 

Instead you can use the standard method of creating a transaction and calling tx.begin, tx.commit.

Jim

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Spring security fix for google app engine

clock August 24, 2009 18:21 by author jimbo

This error occurs when running spring security on GAE.

EXCEPTION
javax.servlet.ServletException: java.lang.ClassNotFoundException:
java.lang.String$CaseInsensitiveComparator

The workaround provided at: http://www.dotnetguru2.org/bmarchesson/index.php?p=1100&more=1&c=1&tb explains using a StringInsensitiveComparator class in order to get around the issue. 

We have provided a download to a working version of spring-security core to save you having to download the source and re-compile.  Please note that we take no responsibility for any damage caused by using the jar.

http://www.google-app-engine.com/blog/downloads/springsec.jar

Jim 

 

Currently rated 5.0 by 5 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Search

Calendar

<<  May 2012  >>
SuMoTuWeThFrSa
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

Archive

Tags

Categories


Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2012

    Sign in