I am getting an issue with the remoteapi for google app engine. I have added the location of the remote api in my class path and I get the following error.
Could not initialize class com.google.appengine.tools.remoteapi.RemoteApiInstaller
Caused by:
java.lang.NoClassDefFoundError: Could not initialize class com.google.appengine.tools.remoteapi.RemoteApiInstaller
at com.kervinramen.spotfinder.servlets.HelperServlet.doGet(HelperServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
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.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)
My classpath is like that
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER/appengine-java-sdk-1.4.3"/>
<classpathentry exported="false" kind="lib" path="/media/files/Kervin/app-engine/appengine-java-sdk-1.4.3/lib/appengine-remote-api.jar"/>
<classpathentry exported="false" kind="lib" path="/media/files/Kervin/app-engine/appengine-java-sdk-1.4.3/lib/impl/appengine-api.jar"/>
<classpathentr开发者_如何学运维y kind="output" path="war/WEB-INF/classes"/>
</classpath>
{$SDK_ROOT} does not work. I have wasted 4 hours on that, cannot resolve the issue. Any comments would be useful for me.
update: I found the problem, has nothing to do with classpath. It cannot be run in a servlet, but must be run in a java application
It is acknowledged bug.
I dont know how it works in JAVA. This is my code in python. I figured out after spending a long time. See if it is of any help to you.
DIR_PATH = "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine"
EXTRA_PATHS = [
DIR_PATH,
os.path.join(DIR_PATH, 'lib', 'yaml', 'lib'),
os.path.join(DIR_PATH, 'lib', 'fancy_urllib'),
]
sys.path = EXTRA_PATHS + sys.path
I found the problem! RemoteApiInstaller cannot be used in a servlet. I created a seperate java project to download the remote database on the local one.
It is fast and works very well! Just the error java gave was so vague! WOW!
精彩评论