Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException when running JettyLauncher with Java 9 #9561

Closed
TDesjardins opened this issue Oct 23, 2017 · 10 comments · Fixed by #9822
Closed

ClassNotFoundException when running JettyLauncher with Java 9 #9561

TDesjardins opened this issue Oct 23, 2017 · 10 comments · Fixed by #9822
Milestone

Comments

@TDesjardins
Copy link

TDesjardins commented Oct 23, 2017

GWT version: 2.8.2
JDK: 1.9


Description

When running GWTUnitTests with Java9 in ProdMode the following Error occures in log:

[ERROR] jreLeakPrevention.gcDaemonFail
java.lang.ClassNotFoundException: sun.misc.GC
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:292)
	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.junit.JUnitShell.getUnitTestShell(JUnitShell.java:708)
	at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:682)
	at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:421)
	at junit.framework.TestCase.runBare(TestCase.java:141)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:129)
	at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:247)
	at junit.framework.TestSuite.runTest(TestSuite.java:252)
	at junit.framework.TestSuite.run(TestSuite.java:247)
	at junit.framework.TestSuite.runTest(TestSuite.java:252)
	at junit.framework.TestSuite.run(TestSuite.java:247)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:369)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:275)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:239)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:160)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)

See also: https://travis-ci.org/TDesjardins/gwt-ol/jobs/291208146#L1547

The cause is presumably that a class (sun.misc.GC) has been moved in Java 9:

https://bugs.openjdk.java.net/browse/JDK-8153286

which is used in the JettyLauncher:

Class<?> clazz = Class.forName("sun.misc.GC");

Steps to reproduce

https://travis-ci.org/TDesjardins/gwt-ol/jobs/291208146

Known workarounds

Use Java 8

@tbroyer
Copy link
Member

tbroyer commented Oct 23, 2017

Another "workaround" is to just ignore the message: it's only logged with error level, it's not a breakage.

I agree we should find a way to silence this though.

@tbroyer tbroyer added this to the 2.8.3 milestone Oct 23, 2017
@MCMicS
Copy link
Contributor

MCMicS commented Oct 25, 2017

@TDesjardins: I fixed this and submit a patch to gerrit.
tested with java 9.0.1

@niloc132
Copy link
Contributor

@MCMicS
Copy link
Contributor

MCMicS commented Jan 7, 2018

any progress here?

@MCMicS
Copy link
Contributor

MCMicS commented Apr 16, 2020

still happens with 2.9.0-RC1

@niloc132
Copy link
Contributor

Once we update the jetty version, we can remove this GC workaround and the message will stop. For now, the error can be safely ignored.

@MCMicS
Copy link
Contributor

MCMicS commented Apr 16, 2020

OK
Found it during Smoke Test. WIll ignore it

@geoffreywiseman
Copy link

Is there any target version for this update / workaround / message hiding?

@diskostu
Copy link

diskostu commented Mar 2, 2021

Any update on this? It's been 3 and a half years since the patch was submitted.
I know the error can be ignored, but, you know, it's an error in the log. Not very nice.

ibaca pushed a commit to ibaca/gwt that referenced this issue Apr 23, 2021
Use Jetty Preventers

Bug: gwtproject#9561
Bug-Link: gwtproject#9561

Change-Id: Ib7818125b825f32e573ab8ee858d2b152d9de729
@niloc132
Copy link
Contributor

niloc132 commented Jun 9, 2022

We upgraded Jetty, but failed to remove this call - it will be removed in the next version.

@niloc132 niloc132 modified the milestones: 2.9, 2.11 Jun 9, 2022
ibaca pushed a commit to ibaca/gwt that referenced this issue Jun 30, 2022
Use Jetty Preventers

Bug: gwtproject#9561
Bug-Link: gwtproject#9561

Change-Id: Ib7818125b825f32e573ab8ee858d2b152d9de729
NJtwentyone added a commit to NJtwentyone/pentaho-commons-xul that referenced this issue Feb 2, 2023
- java.lang.NoSuchMethodError: org.eclipse.jetty.server.ServerConnector.setSoLingerTime(I)V
- java.lang.ClassNotFoundException: sun.misc.GC
-- gwtproject/gwt#9561
niloc132 pushed a commit to niloc132/gwt that referenced this issue Apr 9, 2023
Use Jetty Preventers

Bug: gwtproject#9561
Bug-Link: gwtproject#9561

Change-Id: Ib7818125b825f32e573ab8ee858d2b152d9de729
niloc132 added a commit that referenced this issue Apr 12, 2023
…9822)

Use Jetty's Preventers instead of removed internal JVM methods.

Fixes #9561
Co-authored-by: mcmics <mcmics84@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants