eclipsepluginslocal

Eclipse Google Cloud plugin Unable to start DevAppServer: InaccessibleObjectException: Unable to make static java.net.URLStreamHandler


Trying to get a basic setup working to run the local Google App Engine running in Eclipse using the Google Cloud Tools for Eclipse, but I keep getting the error below when starting the server using the Run As -> App Engine option.

I believe my environment is good because I am able to run the test application with a local app server from the command line using the java_dev_appserver command, so the problem seems specific to the Eclipse environment.

    at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:383)
    at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:315)
    at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:385)
    at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:59)
    at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:259)
    at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:250)
Caused by: java.lang.ExceptionInInitializerError
    at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:136)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:368)
    ... 5 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make static java.net.URLStreamHandler java.net.URL.getURLStreamHandler(java.lang.String) accessible: module java.base does not "opens java.net" to unnamed module @49c43f4e
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
    at com.google.appengine.tools.development.StreamHandlerFactory.<clinit>(StreamHandlerFactory.java:53)
    ... 12 more

I started from a clean Windows 11 machine, installed Google Cloud SDK, added the app-engine-java component, configured a project, tested by deploying to the cloud with the CLI, installed Eclipse, added the Google Tools for Eclipse plugin, created a sample project using the Google plugin Create Project -> Google App Engine Standard project, and tried to run it.

This is probably very simple but I can't figure it out.


Solution

  • The problem was happening with JRE v17 that installs by default with Eclipse 2021-12. Installing Eclipse with JRE v11 solved the problem. Thanks to greg-449 for putting me on the right track.