syslog-ng icon indicating copy to clipboard operation
syslog-ng copied to clipboard

Java 9+ support

Open MrAnno opened this issue 2 years ago • 11 comments

  • javah has been removed from JDK 10, javac -h should be used instead
  • fix illegal reflection issue with Java 9+:

The system class loader of syslog-ng has been replaced with our own implementation, which extends the default URLClassLoader.

That way, the protected addURL() method can be used directly without reflection.

Please note that URLClassLoader::addURL() is protected for a good reason. Once a URL-based class loader is initialized, we should not really modify its class paths. This is still being done in this PR, a real fix would restructure our Java module's initialization logic so that we don't have to extend our class paths more than once (we'd probably have to fix Java VM reinitialization during reload first).

Fixes #3053 Fixes #1943


Requires testing:

  • [x] internal regression tests

MrAnno avatar Jun 22 '22 14:06 MrAnno

Build SUCCESS

kira-syslogng avatar Jun 22 '22 15:06 kira-syslogng

Build SUCCESS

kira-syslogng avatar Jun 22 '22 16:06 kira-syslogng

The CI is failing because I've enabled building Java modules in devshell and it requires rebuilding dbld images.

You can check test results in my fork: https://github.com/MrAnno/syslog-ng/commits/java-18-test

MrAnno avatar Jun 28 '22 18:06 MrAnno

Build FAILURE

kira-syslogng avatar Jun 28 '22 18:06 kira-syslogng

Build FAILURE

kira-syslogng avatar Jun 28 '22 19:06 kira-syslogng

Build FAILURE

kira-syslogng avatar Jul 04 '22 10:07 kira-syslogng

Build FAILURE

kira-syslogng avatar Jul 04 '22 22:07 kira-syslogng

Build FAILURE

kira-syslogng avatar Jul 07 '22 13:07 kira-syslogng

@kira-syslogng test this please test branch=newer-java-version;

MrAnno avatar Jul 07 '22 13:07 MrAnno

Build FAILURE

kira-syslogng avatar Jul 07 '22 13:07 kira-syslogng

@kira-syslogng test this please test branch=newer-java-version;

MrAnno avatar Jul 07 '22 13:07 MrAnno

I've rebased this PR against the current master. We've previously run internal tests on this branch, and we had 2 reviewers before the rebase.

There is still a refcache issue with newer Java versions, but I think the PR could go in without that fix because it improves the current situation a bit anyway.

MrAnno avatar Dec 03 '22 02:12 MrAnno

Build FAILURE

kira-syslogng avatar Dec 03 '22 03:12 kira-syslogng

Build FAILURE

kira-syslogng avatar Dec 03 '22 03:12 kira-syslogng

Build FAILURE

kira-syslogng avatar Dec 03 '22 15:12 kira-syslogng

Build FAILURE

kira-syslogng avatar Dec 03 '22 16:12 kira-syslogng

@kira-syslogng retest this please

MrAnno avatar Dec 03 '22 18:12 MrAnno

I've rebased this PR against the current master. We've previously run internal tests on this branch, and we had 2 reviewers before the rebase.

There is still a refcache issue with newer Java versions, but I think the PR could go in without that fix because it improves the current situation a bit anyway.

I am approving this based on the two earlier reviewers and that it does not touch anything material outside of modules/java and java-modules.

bazsi avatar Dec 05 '22 09:12 bazsi

I've updated NEWS.md with this sentence:

+  * `java()` destinations: fixed compatibility with newer Java versions,
+    syslog-ng is now able to compile up to Java 18.
+

If you have any more details to add, please let me know.

bazsi avatar Dec 05 '22 09:12 bazsi