I'm working on a Java App Engine application using Java 7 in Eclipse Photon. I have an existed App engine Java web application received from one of our developers when I create a new App engine standard project and import this project and try to run it return this error:
Server App Engine Standard at localhost failed to start.
And Here's the stack trace:
Warning: Google App Engine Java 7 runtime is deprecated.
Warning: See https://cloud.google.com/appengine/docs/deprecations/java7
java.lang.RuntimeException: Unable to create a DevAppServer
at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:401)
at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:31)
at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:318)
at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:315)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:314)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:374)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:247)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:238)
Caused by: java.lang.ClassCastException: ClassLoader is jdk.internal.loader.ClassLoaders$AppClassLoader@4459eb14, not a URLClassLoader.
at com.google.apphosting.utils.security.SecurityManagerInstaller.generatePolicyFile(SecurityManagerInstaller.java:139)
at com.google.apphosting.utils.security.SecurityManagerInstaller.install(SecurityManagerInstaller.java:94)
at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:377)
... 9 more
So your stack trace indicates that you are launching with a Java 9 VM (or later), which isn't supported the App Engine development tools.
Assuming you're using the Cloud Tools for Eclipse, first ensure your Google Cloud SDK is up-to-date. If you're using your own copy, run
gcloud components update
on the command-line. If you're letting Cloud Tools for Eclipse manage your SDK, then open Preferences > Google Cloud Tools and choose Update.You'll then need to configure Eclipse to use a Java 8 JRE or JDK as the default JVM for Java 8 launches:
JavaSE-1.8
, and ensure that your Java 8 VM is checked as the default VM.(You can repeat the above if you're using a Java 1.7 VM, though note that App Engine support for Java 7 will be turned off in January 2019.)
You should then be able to launch.