audit4j / audit4j-core

An open source auditing framework.
http://audit4j.org
Apache License 2.0
126 stars 76 forks source link

Java 10 compatibility Issue #85

Open belchandan opened 5 years ago

belchandan commented 5 years ago

I am updating my application to Java10 and found Audit4J checks Java environment, I believe due to checking version in 1.X format, which works for 1.7, 1.8 etc but in Java10 version format has changed to 10.X. I have updated this part of audit4J-core (locally only for now), the version issue seem to resolved but now SpringAudit4jConfig is causing issues, error log below: --//-- Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.audit4j.integration.spring.SpringAudit4jConfig]: Factory method 'springAudit4jConfig' threw exception; nested exception is java.lang.LinkageError --//--

Any suggestion please?

bcaure commented 5 years ago

I don't have any problem with Java 10 besides method isJDK_N_OrHigher(int n) Could you post your audit4j config?

billdinger commented 4 years ago

I'm also having the issue with java 11 @bcaure

java --version
java 11.0.4 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode

Exception being thrown is:

Caused by: org.audit4j.core.exception.InitializationException: Java version is not supported.
        at org.audit4j.core.Context.checkEnvironment(Context.java:315) ~[audit4j-core-2.5.0.jar:2.5.0]
        at org.audit4j.core.Context.init(Context.java:121) ~[audit4j-core-2.5.0.jar:2.5.0]

If I flip it to 1.8

java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

it executes without issues. Using latest (2.5.0) of audit4j

billdinger commented 4 years ago

Hrrm I debugged this on my home PC and when manually substituting in the version number in private static boolean isJDK_N_OrHigher(int n) when running the test it works fine. I wonder if the issue more has to do with the System.getProperty("java.version"); on mac returning something weird. I'll take a look at work tomorrow when I get back.

pauldambra commented 4 years ago

I'm getting this on trying to update a project to java 11 on my mac

pauldambra commented 4 years ago

If I run System.out.println(System.getProperty("java.version")) in a shell in IntelliJ

I get 11.0.2 as the output

pauldambra commented 4 years ago

@janithb any chance we could merge this (or fix it another way :))

I've an app at work that depends on this library (thank you for it btw) and we can't update to Java 11 because of this issue.

billdinger commented 4 years ago

@pauldambra I was able to eventually fix this on my mac by wiping out the JDK and doing a fresh install of adoptopenjdk. I'm still unsure what on my mac caused it but that did fix it.

pauldambra commented 4 years ago

I can't risk having to try and do that through CI and into multiple application servers though

The code change I've proposed does remove the issue (I think)

It removes the need for this comment https://github.com/audit4j/audit4j-core/pull/94/files#diff-977dbf33e7beb1cd8309627cf774cbdfL53

jamietanna commented 4 years ago

I'd be happy picking up this issue if that's OK? :smile:

pauldambra commented 4 years ago

Do you have commit permissions on this repo @jamietanna ?

We've forked here https://github.com/coopdigital/audit4j-core (although looks like we've not updated it yet :/)

jamietanna commented 4 years ago

No I don't @pauldambra - I was thinking of raising a PR to this repo via a fork of my own

pauldambra commented 4 years ago

Ah, yeah, I've had a PR open for it for months. It's either abandoned or the maintainer doesn't want this fix.

I'll check on Monday why we haven't updated our fork. We've been super busy the last couple weeks but the intention is to leave our fork available with the fix

On Sat, 3 Oct 2020, 11:38 Jamie Tanna, notifications@github.com wrote:

No I don't @pauldambra https://github.com/pauldambra - I was thinking of raising a PR to this repo via a fork of my own

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/audit4j/audit4j-core/issues/85#issuecomment-703083260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHQN4PRO3DVJM7XPKFJPZTSI35L7ANCNFSM4F66CGZQ .

jamietanna commented 4 years ago

Oh sorry I didn't realise, that makes sense

pauldambra commented 4 years ago

No worries :) https://github.com/audit4j/audit4j-core/pull/94 that's my PR

I don't have time to review yours this weekend (sorry!) you're welcome to review mine though!