Describe the bug
Trying to encode capabilities message fails with exception on java 11 and newer.
To Reproduce
Steps to reproduce the behavior:
- Build using mvn package
- Run java -jar ./arts-cli/target/arts-client-cli-0.0.1-SNAPSHOT.jar
- Select option 3 ( [3] Encode capabilities message)
- Enter anything on next options
- There would be an exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at de.saschadoemer.arts.client.commandline.handler.EncodeCapabilitiesHandler.handle(EncodeCapabilitiesHandler.java:55)
at de.saschadoemer.arts.client.commandline.Main.main(Main.java:32)
Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
at org.apache.logging.log4j.LogManager.callerClass(LogManager.java:576)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:601)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:588)
at com.dke.data.agrirouter.api.service.LoggingEnabledService.(LoggingEnabledService.java:30)
... 2 more
Expected behavior
Encoded capabilities message returned.
Screenshots
Desktop (please complete the following information):
- OS: I tried on both Windows and Linux (via Docker in WSL2)
- Java: I tried 20 (on Windows), 11, 17 on Linux ( 8 has different issue, but it can be easily bypassed)
Additional context
I believe that this is due to issues with Java 9 modules system. As of agrirouter java sdk 2, log4j is not used anymore and "LoggingEnabledService" does not create issues (as it is removed).
So the right solution would appear to be to update to SDK version 2 (which includes changing some other stuff).
Alternatively (what is also solved issue temporarily) - switching maven-compiler-plugin.target to 8 and running on Java 8, fixes this too (I tried with both building and running using openjdk:8 docker container).