Sunday, August 11, 2013

Issue encounter and simple note on Google AppEngine exploration

Issue 1

During the deployment of the sample app "Guestbook" to AppEngine through Eclipse, error message "Unable to update app: Cannot get the System Java Compiler. Please use a JDK, not a JRE." is prompted. Please refer to the screenshot as shown below:

Steps to resolve
1. Open the eclipse.ini, normally located at "ECLIPSE home path".
2. Add configuration as shown below in the first line of eclipse.ini.
3. Restart Eclipse and redeploy the app to AppEngine, you will be able to get this through.

Issue 2

Try to use Jersey (version 1.7) to create JAX-RS service on Google App Engine, please refer to
Encounter the error in AppEngine log as described below when use browser to call the service.

Uncaught exception from servlet
java.lang.IncompatibleClassChangeError: Implementing class
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(
 at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(
 at java.lang.reflect.Method.invoke(
 at java.lang.ClassLoader.loadClass(
 at com.sun.jersey.api.core.ScanningResourceConfig.init(
 at com.sun.jersey.api.core.PackagesResourceConfig.init(
 at com.sun.jersey.api.core.PackagesResourceConfig.(
 at com.sun.jersey.api.core.PackagesResourceConfig.(
 at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(
 at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(
 at com.sun.jersey.spi.container.servlet.WebComponent.init(
 at com.sun.jersey.spi.container.servlet.ServletContainer.init(
 at com.sun.jersey.spi.container.servlet.ServletContainer.init(
 at javax.servlet.GenericServlet.init(
 at org.mortbay.jetty.servlet.ServletHolder.initServlet(
 at org.mortbay.jetty.servlet.ServletHolder.doStart(
 at org.mortbay.component.AbstractLifeCycle.start(
 at org.mortbay.jetty.servlet.ServletHandler.initialize(
 at org.mortbay.jetty.servlet.Context.startContext(
 at org.mortbay.jetty.webapp.WebAppContext.startContext(
 at org.mortbay.jetty.handler.ContextHandler.doStart(
 at org.mortbay.jetty.webapp.WebAppContext.doStart(
 at org.mortbay.component.AbstractLifeCycle.start(

Steps to resolve
1. Right click project in Eclipse and select "Properties".
2. Change "Datanuclues JDO/JPA version to "v1". Please refer to screenshot as described below.

3. Redeploy the app to AppEngine. You should be able to call the service.

Reason: The used of asm-4.0.jar by AppEngine crash with the Jersey 1.7.

1 comment:

rAeviLmAn D said...

Thanks a lot for this post. Actually I faced issues as you did. before hitting your blog I read 4-5 stackoverflow posts telling to use jarjar tool and i did use tht but in vain your simple solution saved my day.,.,seriously thanks for publishing this.