question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Illegal Access running under Java 11 and Spring Boot

See original GitHub issue

When running Datagrid under Spring and Java 8, the application starts flawlessly:

   _____ _                     _      _        _____        _                   _     _ 
  / ____| |                   (_)    | |      |  __ \      | |                 (_)   | |
 | |    | |__  _ __ ___  _ __  _  ___| | ___  | |  | | __ _| |_ __ _  __ _ _ __ _  __| |
 | |    | '_ \| '__/ _ \| '_ \| |/ __| |/ _ \ | |  | |/ _` | __/ _` |/ _` | '__| |/ _` |
 | |____| | | | | | (_) | | | | | (__| |  __/ | |__| | (_| | || (_| | (_| | |  | | (_| |
  \_____|_| |_|_|  \___/|_| |_|_|\___|_|\___| |_____/ \__,_|\__\__,_|\__, |_|  |_|\__,_|
                                                                      __/ |             
:: Chronicle Datagrid ::      (2.19.8-SNAPSHOT)                      |___/              
Server ID:   1
Configuration file: /Users/pemi/git/chronicle/customer/chronicle-datagrid-sdk-test/datagrid.yaml
Running under Java(TM) SE Runtime Environment 1.8.0_191-b12 with 16 processors reported.
Listening for incoming connections on port 0.0.0.0:9090
Press CTRL+C to kill the Chronicle Datagrid Server process.

However, using the same setup but running under Java 11 will produce an illegal access:

2020-05-08 12:54:11.797  WARN 35412 --- [           main] s.c.d.ServerLauncher                     : The file /Users/pemi/git/chronicle/customer/chronicle-datagrid-sdk-test/datagrid.yaml does not exist.
   _____ _                     _      _        _____        _                   _     _ 
  / ____| |                   (_)    | |      |  __ \      | |                 (_)   | |
 | |    | |__  _ __ ___  _ __  _  ___| | ___  | |  | | __ _| |_ __ _  __ _ _ __ _  __| |
 | |    | '_ \| '__/ _ \| '_ \| |/ __| |/ _ \ | |  | |/ _` | __/ _` |/ _` | '__| |/ _` |
 | |____| | | | | | (_) | | | | | (__| |  __/ | |__| | (_| | || (_| | (_| | |  | | (_| |
  \_____|_| |_|_|  \___/|_| |_|_|\___|_|\___| |_____/ \__,_|\__\__,_|\__, |_|  |_|\__,_|
                                                                      __/ |             
:: Chronicle Datagrid ::      (2.19.8-SNAPSHOT)                      |___/              
Server ID:   1
Configuration file: /Users/pemi/git/chronicle/customer/chronicle-datagrid-sdk-test/datagrid.yaml
Running under OpenJDK Runtime Environment 11.0.6+8-b765.40 with 16 processors reported.
2020-05-08 12:54:11.864  WARN 35412 --- [           main] n.o.c.c.c.CleanerServiceLocator          : Error while trying to load service providers

java.util.ServiceConfigurationError: net.openhft.chronicle.core.cleaner.spi.ByteBufferCleanerService: Provider net.openhft.chronicle.core.cleaner.impl.reflect.ReflectionBasedByteBufferCleanerService could not be instantiated
	at java.util.ServiceLoader.fail(ServiceLoader.java:581) ~[?:?]
	at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:803) ~[?:?]
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721) ~[?:?]
	at java.util.ServiceLoader$3.next(ServiceLoader.java:1394) ~[?:?]
	at net.openhft.chronicle.core.cleaner.CleanerServiceLocator.cleanerService(CleanerServiceLocator.java:27) [chronicle-core-2.19.6.jar:?]
	at net.openhft.chronicle.bytes.NativeBytesStore.<clinit>(NativeBytesStore.java:44) [chronicle-bytes-2.19.7.jar:?]
	at net.openhft.chronicle.bytes.BytesStore.from(BytesStore.java:52) [chronicle-bytes-2.19.7.jar:?]
	at net.openhft.chronicle.wire.WireType.<clinit>(WireType.java:328) [chronicle-wire-2.19.11.jar:?]
	at software.chronicle.datagrid.internal.ServerFactory.createAssetTree(ServerFactory.java:76) [chronicle-datagrid-2.19.8-SNAPSHOT.jar:2.19.8-SNAPSHOT]
	at software.chronicle.datagrid.internal.ServerFactory.datagridMain(ServerFactory.java:61) [chronicle-datagrid-2.19.8-SNAPSHOT.jar:2.19.8-SNAPSHOT]
	at software.chronicle.datagrid.internal.VanillaServerBuilder.build(VanillaServerBuilder.java:62) [chronicle-datagrid-2.19.8-SNAPSHOT.jar:2.19.8-SNAPSHOT]
	at software.chronicle.datagrid.ServerLauncher.run(ServerLauncher.java:114) [chronicle-datagrid-2.19.8-SNAPSHOT.jar:2.19.8-SNAPSHOT]
	at com.okcoin.chronicle.sender.Server.run(Server.java:31) [classes/:?]
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:775) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:765) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
	at com.okcoin.chronicle.sender.Application.main(Application.java:11) [classes/:?]
Caused by: java.lang.ExceptionInInitializerError
	at net.openhft.chronicle.core.cleaner.impl.reflect.ReflectionBasedByteBufferCleanerService.<clinit>(ReflectionBasedByteBufferCleanerService.java:28) ~[chronicle-core-2.19.6.jar:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
	at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:779) ~[?:?]
	... 17 more
Caused by: java.lang.IllegalAccessException: symbolic reference class is not accessible: class jdk.internal.ref.Cleaner, from net.openhft.chronicle.core.cleaner.impl.reflect.ReflectionBasedByteBufferCleanerService (unnamed module @7ed9499e)
	at java.lang.invoke.MemberName.makeAccessException(MemberName.java:942) ~[?:?]
	at java.lang.invoke.MethodHandles$Lookup.checkSymbolicClass(MethodHandles.java:2054) ~[?:?]
	at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:2026) ~[?:?]
	at java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:1194) ~[?:?]
	at net.openhft.chronicle.core.cleaner.impl.reflect.ReflectionBasedByteBufferCleanerService.<clinit>(ReflectionBasedByteBufferCleanerService.java:26) ~[chronicle-core-2.19.6.jar:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
	at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:779) ~[?:?]
	... 17 more

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
minborgcommented, May 12, 2020

export MAVEN_OPTS="--illegal-access=permit --add-exports java.base/jdk.internal.ref=ALL- UNNAMED" makes the problem go away.

0reactions
hft-team-citycommented, Oct 21, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Java 9 Illegal Reflective Access Warning - Baeldung
Learn about Java 9 illegal reflective access warning. ... Get started with Spring 5 and Spring Boot 2, through the Learn Spring course:....
Read more >
illegal-access JVM argument to spring boot maven plugin ...
In IntelliJ, open the run configuration for your app and under Environment->VM options add --illegal-access=permit. See the attached image, ...
Read more >
An illegal reflective access operation has occurred when ...
An illegal reflective access operation has occurred when using Java 11 with ForgeRock products. Last updated Aug 18, 2022.
Read more >
Solutions to common problems - Synopsys Detect
The issue has been fixed in Groovy 3 as per GROOVY-8339. Clients running Synopsys Detect with Java 11 will have these warnings until...
Read more >
Transition from Java 8 to Java 11 - Azure - Microsoft Learn
Setting the command line option --illegal-access=warn is recommended. In Java 11, using reflection to access to JDK-internal API will result in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found