Search code examples
javaintellij-ideagwtgwt-rpc

jreLeakPrevention.gcDaemonFail Error while running GWT application


Getting error while running a simple GWT application. when I ran by ant through command line it worked fine but after importing in IntelliJ I am getting this error. Don't know why I am getting this error:

The code server is ready at http://127.0.0.1:9876/
Code server started in 9.247 s ms
2019-11-09 01:07:02.250:INFO:oejs.ServerConnector:main: Started ServerConnector@1d54b16e{HTTP/1.1}{127.0.0.1:9876}
2019-11-09 01:07:02.250:INFO:oejs.Server:main: Started @10313ms
**[ERROR] jreLeakPrevention.gcDaemonFail
java.lang.ClassNotFoundException: sun.misc.GC**
  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
  at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
  at java.base/java.lang.Class.forName0(Native Method)
  at java.base/java.lang.Class.forName(Class.java:315)
  at com.google.gwt.dev.shell.jetty.JettyLauncher.jreLeakPrevention(JettyLauncher.java:899)
  at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:722)
  at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
  at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)
  at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)
  at com.google.gwt.dev.DevMode.main(DevMode.java:432)
2019-11-09 01:07:02.307:INFO:oejs.Server:main: jetty-9.2.z-SNAPSHOT
Starting Jetty on port 8888
   [WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@e59f292{/,file:/Users/pchenchala/Library/Caches/IntelliJIdea2019.2/gwt/mywebapp.4e8f7f71/MyWebApp.c24f5151/run/www/,STARTING}{/Users/pchenchala/Library/Caches/IntelliJIdea2019.2/gwt/mywebapp.4e8f7f71/MyWebApp.c24f5151/run/www}
java.lang.RuntimeException: Error scanning file GreetingServiceImpl.class
  at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:708)
  at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
  at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
  at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
  at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
  at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:824)
  at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
  at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
  at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
  at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalArgumentException
  at org.objectweb.asm.ClassReader.<init>(Unknown Source)
  at org.objectweb.asm.ClassReader.<init>(Unknown Source)
  at org.objectweb.asm.ClassReader.<init>(Unknown Source)
  at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973)
  at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:702)
  ... 10 more
2019-11-09 01:07:05.521:INFO:oejs.ServerConnector:main: Started ServerConnector@539f3a98{HTTP/1.1}{127.0.0.1:8888}
2019-11-09 01:07:05.528:INFO:oejs.Server:main: Started @13591ms
Dev Mode initialized. Startup URL: 
http://127.0.0.1:8888/MyWebApp.html
[ERROR] 503 - GET /MyWebApp.html (127.0.0.1) 301 bytes
   Request headers
      Host: 127.0.0.1:8888
      Connection: keep-alive
      Upgrade-Insecure-Requests: 1
      User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87

Safari/537.36 Sec-Fetch-User: ?1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Accept-Encoding: gzip, deflate, br Accept-Language: en-GB,en-US;q=0.9,en;q=0.8 If-Modified-Since: Fri, 08 Nov 2019 16:26:04 GMT Response headers Date: Fri, 08 Nov 2019 19:37:05 GMT Cache-Control: must-revalidate,no-cache,no-store Content-Type: text/html; charset=ISO-8859-1 Content-Length: 301 [ERROR] 503 - GET /MyWebApp.html (127.0.0.1) 301 bytes Request headers Host: 127.0.0.1:8888 Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36 Sec-Fetch-User: ?1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Accept-Encoding: gzip, deflate, br Accept-Language: en-GB,en-US;q=0.9,en;q=0.8 Response headers Date: Fri, 08 Nov 2019 19:39:53 GMT Cache-Control: must-revalidate,no-cache,no-store Content-Type: text/html; charset=ISO-8859-1 Content-Length: 301 GET /clean/mywebapp Cleaning disk caches. Cleaned in 13ms. [ERROR] 503 - GET /MyWebApp.html (127.0.0.1) 301 bytes Request headers Host: 127.0.0.1:8888 Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36 Sec-Fetch-User: ?1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Accept-Encoding: gzip, deflate, br Accept-Language: en-GB,en-US;q=0.9,en;q=0.8 Response headers Date: Fri, 08 Nov 2019 19:52:14 GMT Cache-Control: must-revalidate,no-cache,no-store Content-Type: text/html; charset=ISO-8859-1 Content-Length: 301

Process finished with exit code 137 (interrupted by signal 9: SIGKILL)

Solution

  • There are two errors here, and they are unrelated.

    java.lang.ClassNotFoundException: sun.misc.GC**
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      at java.base/java.lang.Class.forName0(Native Method)
      at java.base/java.lang.Class.forName(Class.java:315)
      at com.google.gwt.dev.shell.jetty.JettyLauncher.jreLeakPrevention(JettyLauncher.java:899)
    

    This is safe to ignore. The checks around this are there to protect against this very thing from happening - the JRE implementation you are using removing this feature. Examining JettyLauncher.java in this version of GWT, you find the following code: https://github.com/gwtproject/gwt/blob/a90832fec9a56f4cb83ed009c7048e0a8d196fe8/dev/core/src/com/google/gwt/dev/shell/jetty/JettyLauncher.java#L898-L915

        try {
          Class<?> clazz = Class.forName("sun.misc.GC");
          Method method = clazz.getDeclaredMethod("requestLatency",
              new Class[]{long.class});
          method.invoke(null, Long.valueOf(3600000));
        } catch (ClassNotFoundException e) {
          logger.log(TreeLogger.ERROR, "jreLeakPrevention.gcDaemonFail", e);
        } catch (SecurityException e) {
          logger.log(TreeLogger.ERROR, "jreLeakPrevention.gcDaemonFail", e);
        } catch (NoSuchMethodException e) {
          logger.log(TreeLogger.ERROR, "jreLeakPrevention.gcDaemonFail", e);
        } catch (IllegalArgumentException e) {
          logger.log(TreeLogger.ERROR, "jreLeakPrevention.gcDaemonFail", e);
        } catch (IllegalAccessException e) {
          logger.log(TreeLogger.ERROR, "jreLeakPrevention.gcDaemonFail", e);
        } catch (InvocationTargetException e) {
          logger.log(TreeLogger.ERROR, "jreLeakPrevention.gcDaemonFail", e);
        }
    

    These catch statements let us log the error, and then resume.


    Second exception:

      [WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@e59f292{/,file:/Users/pchenchala/Library/Caches/IntelliJIdea2019.2/gwt/mywebapp.4e8f7f71/MyWebApp.c24f5151/run/www/,STARTING}{/Users/pchenchala/Library/Caches/IntelliJIdea2019.2/gwt/mywebapp.4e8f7f71/MyWebApp.c24f5151/run/www}
    java.lang.RuntimeException: Error scanning file GreetingServiceImpl.class
      at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:708)
      at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
      at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
      at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
      at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:688)
      at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:824)
      at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
      at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.IllegalArgumentException
      at org.objectweb.asm.ClassReader.<init>(Unknown Source)
      at org.objectweb.asm.ClassReader.<init>(Unknown Source)
      at org.objectweb.asm.ClassReader.<init>(Unknown Source)
      at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973)
      at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:702)
      ... 10 more
    

    This is a separate error, unrelated to the above, or the title of your post. I'm less sure about what is happening here - best guess, you have some bytecode which asm is unable to read when scanning. Perhaps clean your project and try again?

    You might have better luck only posting about this error, since the other error is just a red herring.