Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 10 compatibility Issue #85

Open
belchandan opened this issue Oct 24, 2018 · 14 comments
Open

Java 10 compatibility Issue #85

belchandan opened this issue Oct 24, 2018 · 14 comments

Comments

@belchandan
Copy link

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
Copy link

bcaure commented Jan 31, 2019

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

@billdinger
Copy link

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
Copy link

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
Copy link

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

@pauldambra
Copy link

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

I get 11.0.2 as the output

@pauldambra
Copy link

@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
Copy link

@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
Copy link

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
Copy link

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

@pauldambra
Copy link

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
Copy link

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

jamietanna added a commit to jamietanna/audit4j-core that referenced this issue Oct 3, 2020
This is a short-term fix that allows consumers to use the project as-is,
but ideally we would move to a more resilient setup that may support
future JDK versions.

Closes audit4j#85.
@pauldambra
Copy link

pauldambra commented Oct 3, 2020 via email

@jamietanna
Copy link

Oh sorry I didn't realise, that makes sense

@pauldambra
Copy link

No worries :) #94 that's my PR

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants