zenmeso / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
0 stars 0 forks source link

HTTP ERROR 500 Could not initialize class com.googlecode.objectify.ObjectifyService objectify:5.0.3 #212

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am new to Android and try to explore things up, using Andriod Studio 0.6.1

in my backend build.gradle:

repositories {
    mavenCentral();
}

dependencies {
    appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.6'
    compile 'javax.servlet:javax.servlet-api:3.1.0'
    compile 'com.googlecode.objectify:objectify:5.0.3'
    compile 'com.google.guava:guava:17.0'
}

my servlet class:

import com.googlecode.objectify.ObjectifyService;
import static com.googlecode.objectify.ObjectifyService.ofy;

        ObjectifyService.register(places.class);
        places myplace = new places("Any Where");
        ofy().save().entity(myplace).now();

When i run the project and trigger the servlet i get the following error:

HTTP ERROR 500

Problem accessing /hello. Reason:

    Could not initialize class com.googlecode.objectify.ObjectifyService

Caused by:

java.lang.NoClassDefFoundError: Could not initialize class 
com.googlecode.objectify.ObjectifyService
    at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:50)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    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:127)
    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.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
    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:98)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:491)
    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)

Original issue reported on code.google.com by alfred.e...@gmail.com on 27 Jun 2014 at 11:26

GoogleCodeExporter commented 9 years ago
this is the build file to help

Original comment by alfred.e...@gmail.com on 27 Jun 2014 at 11:58

Attachments:

GoogleCodeExporter commented 9 years ago
This is not a bug request, this is a support request - please use the Google 
Group. This has something to do with your build or runtime environment, I can't 
tell what from what you have posted. From the lowercase 'places' I presume you 
are fairly new to java, and getting the build environment set up properly can 
be tricky.

My guess is that this is related to your inclusion of the 3.1 servlet api jar.  
Not only is GAE on an older spec version (2.5), but you must use the gradle 
equivalent of maven's <scope>provided</scope>.

If you wish additional help, please consult the Group.

Original comment by lhori...@gmail.com on 28 Jun 2014 at 3:10