Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix(java): add --add-modules=jdk.httpserver option address ClassNotFoundException in GraalVM 22.2.0 #1816

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

mpeddada1
Copy link
Contributor

This issue was first discovered in googleapis/java-compute#754 (comment):

Fatal error: org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-vintage' failed to discover tests
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:134)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:108)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:80)
	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:110)
	at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:78)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.discover(DefaultLauncherSession.java:81)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:46)
	at org.graalvm.junit.platform.JUnitPlatformFeature.discoverTestsAndRegisterTestClassesForReflection(JUnitPlatformFeature.java:135)
	at org.graalvm.junit.platform.JUnitPlatformFeature.beforeAnalysis(JUnitPlatformFeature.java:94)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$9(NativeImageGenerator.java:722)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:78)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:722)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:564)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
Caused by: java.lang.NoClassDefFoundError: com/sun/net/httpserver/HttpHandler
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
	at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3427)
	at java.base/java.lang.Class.getMethods(Class.java:2019)
	at org.junit.platform.commons.util.ReflectionUtils.getDefaultMethods(ReflectionUtils.java:1520)
	at org.junit.platform.commons.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:1493)
	at org.junit.platform.commons.util.ReflectionUtils.findAllMethodsInHierarchy(ReflectionUtils.java:1435)
	at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:1419)
	at org.junit.platform.commons.util.ReflectionUtils.findMethods(ReflectionUtils.java:1405)
	at org.junit.vintage.engine.descriptor.TestSourceProvider.lambda$findMethod$1(TestSourceProvider.java:75)
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)
	at java.base/java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2760)
	at org.junit.vintage.engine.descriptor.TestSourceProvider.findMethod(TestSourceProvider.java:75)
	at org.junit.vintage.engine.descriptor.TestSourceProvider.computeTestSource(TestSourceProvider.java:56)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1740)
	at org.junit.vintage.engine.descriptor.TestSourceProvider.findTestSource(TestSourceProvider.java:47)
	at org.junit.vintage.engine.discovery.RunnerTestDescriptorPostProcessor.addChildrenRecursively(RunnerTestDescriptorPostProcessor.java:62)
	at org.junit.vintage.engine.discovery.RunnerTestDescriptorPostProcessor.applyFiltersAndCreateDescendants(RunnerTestDescriptorPostProcessor.java:41)
	at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:46)
	at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:64)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
	... 17 more
Caused by: java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	... 38 more

TODO: This issue is tracked upstream and and should no longer be needed once GraalVM 22.3 is released.

@mpeddada1 mpeddada1 requested review from a team as code owners October 7, 2022 17:59
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@meltsufin meltsufin merged commit ae6e8be into main Oct 18, 2022
@meltsufin meltsufin deleted the grl22.2-httpserver branch October 18, 2022 02:35
gcf-merge-on-green bot pushed a commit that referenced this pull request Oct 19, 2022
🤖 I have created a release *beep* *boop*
---


## [2.19.3](https://togithub.com/googleapis/gax-java/compare/v2.19.2...v2.19.3) (2022-10-19)


### Bug Fixes

* **deps:** Update dependency com.google.auth:google-auth-library-credentials to v1.12.0 ([#1822](https://togithub.com/googleapis/gax-java/issues/1822)) ([ad139e4](https://togithub.com/googleapis/gax-java/commit/ad139e45d29bd0fbf6b6f080b12ef9a987fa2e0d))
* **deps:** Update dependency com.google.auth:google-auth-library-credentials to v1.12.1 ([#1830](https://togithub.com/googleapis/gax-java/issues/1830)) ([d726921](https://togithub.com/googleapis/gax-java/commit/d7269210767a92e94568712920b34064278dddbc))
* **deps:** Update dependency com.google.auth:google-auth-library-oauth2-http to v1.12.0 ([#1823](https://togithub.com/googleapis/gax-java/issues/1823)) ([c6180ca](https://togithub.com/googleapis/gax-java/commit/c6180cacdaf4d191098e499eff0f6b014e730654))
* **deps:** Update dependency com.google.auth:google-auth-library-oauth2-http to v1.12.1 ([#1831](https://togithub.com/googleapis/gax-java/issues/1831)) ([227c8af](https://togithub.com/googleapis/gax-java/commit/227c8af66c95e86e8d90e5de9dd3f429895b44cc))
* **deps:** Update dependency com.google.protobuf:protobuf-bom to v3.21.8 ([#1828](https://togithub.com/googleapis/gax-java/issues/1828)) ([462a100](https://togithub.com/googleapis/gax-java/commit/462a1009a84a046da28298ad10f23cadfb7a61ea))
* **deps:** Update dependency io.grpc:grpc-bom to v1.50.1 ([#1819](https://togithub.com/googleapis/gax-java/issues/1819)) ([75600ea](https://togithub.com/googleapis/gax-java/commit/75600eab90ec2e33378c00824535763f5df87b24))
* **deps:** Update dependency org.graalvm.sdk:graal-sdk to v22.2.0.1 ([#1817](https://togithub.com/googleapis/gax-java/issues/1817)) ([a8f8ae2](https://togithub.com/googleapis/gax-java/commit/a8f8ae2b5e035dc08ce161134ec2e441e6c2d4fc))
* **deps:** Update dependency org.threeten:threetenbp to v1.6.3 ([#1821](https://togithub.com/googleapis/gax-java/issues/1821)) ([3bca572](https://togithub.com/googleapis/gax-java/commit/3bca572486e7780ff8fb8b581aa691738885401c))
* **java:** Address ClassNotFoundException in GraalVM 22.2.0 ([#1816](https://togithub.com/googleapis/gax-java/issues/1816)) ([ae6e8be](https://togithub.com/googleapis/gax-java/commit/ae6e8beb6ed5525504df1a3bb7ce71bdf114a233))
* **java:** Address reachability issues in native image compilation with version 22.2.0 ([#1815](https://togithub.com/googleapis/gax-java/issues/1815)) ([0f3215f](https://togithub.com/googleapis/gax-java/commit/0f3215f98bfc5def4e608c780d91953900e17946))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants