title: Error using google objectify
body: <p>i am getting error while using objectify.
  Actually i am using it in a very simple spring based application, but not getting the proper way to do the same.
  to keep it simple, i am not using any service/dao layer.</p>
  
  <p>Model:</p>
  
  <pre><code>package com.tut.yudi.model;
  
  import com.googlecode.objectify.annotation.Entity;
  import com.googlecode.objectify.annotation.Id;
  import com.googlecode.objectify.annotation.Index;
  
  //import java.util.Date;
  import java.io.Serializable;
  
  @Entity
  public class Subject implements Serializable {
  
      private static final long serialVersionUID = 1L;
      //private long subjectId;
  
    @Id
      @Index
      private String subjectName;
      private int subjectRank;
      private char status;
  
      public String getSubjectName() {
          return subjectName;
      }
      public void setSubjectName(String subjectName) {
          this.subjectName = subjectName;
      }
      public int getSubjectRank() {
          return subjectRank;
      }
      public void setSubjectRank(int subjectRank) {
          this.subjectRank = subjectRank;
      }
      public char getStatus() {
          return status;
      }
      public void setStatus(char status) {
          this.status = status;
      }
  
  }
  </code></pre>
  
  <p>OfyService class:</p>
  
  <pre><code>package com.tut.yudi.common.dao;
  
  import com.googlecode.objectify.Objectify;
  import com.googlecode.objectify.ObjectifyFactory;
  import com.googlecode.objectify.ObjectifyService;
  import com.tut.yudi.model.Subject;
  
  public class OfyService {
      static {
          factory().register(Subject.class);
          //ObjectifyService.register(Subject.class); --also doesn't work
      }
  
      public static Objectify ofy() {
          return ObjectifyService.ofy();
      }
  
      public static ObjectifyFactory factory() {
          return ObjectifyService.factory();
      }
  }
  </code></pre>
  
  <p>my controller:</p>
  
  <pre><code>    package com.tut.yudi.controller;
  
  import static com.tut.yudi.common.dao.OfyService.ofy;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  import com.tut.yudi.controller.Hello;
  import com.tut.yudi.model.Subject;
  
  import java.util.logging.Logger;
  
  @Controller
  public class Hello
  {
     protected static Logger logger = Logger.getLogger(Hello.class.getName());
  
     @RequestMapping("/")
     public String home()
     {
        //sop();
        return "a";
     }
  
     @RequestMapping(value = "/hello")
     public String hello()
     {
        //sop();
  
        //some comment
  
        Subject subject = new Subject();
        subject.setSubjectName("JAVA");
        subject.setSubjectRank(1);
        subject.setStatus('A');
        System.out.println("Model object created...");
  
        //some coment
        ofy().save().entity(subject).now();
        System.out.println("object created....");
        return "b";
     }
  
  }
  </code></pre>
  
  <p>Here are the logs :</p>
  
  <pre><code>Dec 24, 2013 9:15:58 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
  INFO: Successfully processed /var/vcap.local/dea/apps/app-g7u2pbf8emc4gvmc-0-df6c037b5f628879778de0427da1f7e4/app/WEB-INF/appengine-web.xml
  Dec 24, 2013 9:15:58 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
  INFO: Successfully processed /var/vcap.local/dea/apps/app-g7u2pbf8emc4gvmc-0-df6c037b5f628879778de0427da1f7e4/app/WEB-INF/web.xml
  Dec 24, 2013 9:15:58 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
  INFO: Overwriting system property key 'java.util.logging.config.file', value '/var/vcap.local/dea/apps/app-g7u2pbf8emc4gvmc-0-df6c037b5f628879778de0427da1f7e4/appengine-java-sdk/config/sdk/logging.properties' with value 'WEB-INF/logging.properties' from '/var/vcap.local/dea/apps/app-g7u2pbf8emc4gvmc-0-df6c037b5f628879778de0427da1f7e4/app/WEB-INF/appengine-web.xml'
  Dec 24, 2013 9:15:58 PM com.google.apphosting.utils.jetty.JettyLogger info
  INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
  Dec 24, 2013 9:15:59 PM com.google.appengine.tools.development.IsolatedAppClassLoader checkWorkingDirectory
  WARNING: Your working directory, (/var/vcap.local/dea/apps/app-g7u2pbf8emc4gvmc-0-df6c037b5f628879778de0427da1f7e4) is not equal to your 
  web application root (/var/vcap.local/dea/apps/app-g7u2pbf8emc4gvmc-0-df6c037b5f628879778de0427da1f7e4/app)
  You will not be able to access files from your working directory on the production server.
  
  Dec 24, 2013 9:15:59 PM com.google.apphosting.utils.jetty.JettyLogger info
  INFO: jetty-6.1.x
  Dec 24, 2013 9:16:20 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
  INFO: javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext
  log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  Dec 24, 2013 9:16:27 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
  INFO: javax.servlet.ServletContext log: Initializing Spring FrameworkServlet 'spring'
  Dec 24, 2013 9:16:27 PM com.google.apphosting.utils.jetty.JettyLogger info
  INFO: Started SelectChannelConnector@0.0.0.0:36886
  Dec 24, 2013 9:16:27 PM com.google.appengine.tools.development.AbstractServer startup
  INFO: Server default is running at http://localhost:36886/
  Dec 24, 2013 9:16:27 PM com.google.appengine.tools.development.AbstractServer startup
  INFO: The admin console is running at http://localhost:36886/_ah/admin
  Dec 24, 2013 9:16:27 PM com.google.appengine.tools.development.DevAppServerImpl start
  INFO: Dev App Server is now running
  Dec 24, 2013 9:17:22 PM com.google.apphosting.utils.jetty.JettyLogger warn
  WARNING: /hello
  java.lang.ExceptionInInitializerError
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:186)
      at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
      at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
      at com.tut.yudi.controller.Hello.hello(Hello.java:38)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
      at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
      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.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
      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:125)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectRequest(DevAppServerServersFilter.java:369)
      at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectServerRequest(DevAppServerServersFilter.java:352)
      at com.google.appengine.tools.development.DevAppServerServersFilter.doFilter(DevAppServerServersFilter.java:115)
      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.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:421)
      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.headerComplete(HttpConnection.java:923)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      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.NullPointerException
      at java.lang.Class.isAssignableFrom(Native Method)
      at com.googlecode.objectify.impl.TypeUtils.isAssignableFrom(TypeUtils.java:179)
      at com.googlecode.objectify.impl.translate.NumberTranslatorFactory.create(NumberTranslatorFactory.java:25)
      at com.googlecode.objectify.impl.translate.NumberTranslatorFactory.create(NumberTranslatorFactory.java:18)
      at com.googlecode.objectify.impl.translate.TranslatorRegistry.create(TranslatorRegistry.java:90)
      at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:52)
      at com.googlecode.objectify.impl.translate.EntityClassTranslator.(EntityClassTranslator.java:46)
      at com.googlecode.objectify.impl.Transmog.(Transmog.java:49)
      at com.googlecode.objectify.impl.ConcreteEntityMetadata.(ConcreteEntityMetadata.java:58)
      at com.googlecode.objectify.impl.Registrar.register(Registrar.java:74)
      at com.googlecode.objectify.ObjectifyFactory.register(ObjectifyFactory.java:180)
      at com.tut.yudi.common.dao.OfyService.(OfyService.java:10)
      ... 58 more
  Dec 24, 2013 9:17:22 PM com.google.apphosting.utils.jetty.JettyLogger warn
  WARNING: Nested in java.lang.ExceptionInInitializerError:
  java.lang.NullPointerException
      at java.lang.Class.isAssignableFrom(Native Method)
      at com.googlecode.objectify.impl.TypeUtils.isAssignableFrom(TypeUtils.java:179)
      at com.googlecode.objectify.impl.translate.NumberTranslatorFactory.create(NumberTranslatorFactory.java:25)
      at com.googlecode.objectify.impl.translate.NumberTranslatorFactory.create(NumberTranslatorFactory.java:18)
      at com.googlecode.objectify.impl.translate.TranslatorRegistry.create(TranslatorRegistry.java:90)
      at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:52)
      at com.googlecode.objectify.impl.translate.EntityClassTranslator.(EntityClassTranslator.java:46)
      at com.googlecode.objectify.impl.Transmog.(Transmog.java:49)
      at com.googlecode.objectify.impl.ConcreteEntityMetadata.(ConcreteEntityMetadata.java:58)
      at com.googlecode.objectify.impl.Registrar.register(Registrar.java:74)
      at com.googlecode.objectify.ObjectifyFactory.register(ObjectifyFactory.java:180)
      at com.tut.yudi.common.dao.OfyService.(OfyService.java:10)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:186)
      at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
      at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
      at com.tut.yudi.controller.Hello.hello(Hello.java:38)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
      at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
      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.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
      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:125)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
      at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectRequest(DevAppServerServersFilter.java:369)
      at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectServerRequest(DevAppServerServersFilter.java:352)
      at com.google.appengine.tools.development.DevAppServerServersFilter.doFilter(DevAppServerServersFilter.java:115)
      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.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:421)
      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.headerComplete(HttpConnection.java:923)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      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)
  </code></pre>
  
  <p>Thanks.</p>