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 Issue on Grobid #418

Closed
jonsaadfalcon opened this issue Apr 6, 2019 · 15 comments
Closed

Java Issue on Grobid #418

jonsaadfalcon opened this issue Apr 6, 2019 · 15 comments

Comments

@jonsaadfalcon
Copy link

Hello, I'm trying to run grobid on MacOS but I encountered an issue when trying to build on gradle. I received the following exception:

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from '11.0.2'.

I updated the gradle version but still received the same error. Any advice is greatly appreciated.

@kermitt2
Copy link
Owner

kermitt2 commented Apr 6, 2019

Hello @jonsaadfalcon !
Did you try this gradle version -> https://grobid.readthedocs.io/en/latest/Troubleshooting/#wrong-java-version

@jonsaadfalcon
Copy link
Author

I did that but I still get the same Java version error.

@jonsaadfalcon
Copy link
Author

Hello @jonsaadfalcon !
Did you try this gradle version -> https://grobid.readthedocs.io/en/latest/Troubleshooting/#wrong-java-version

I did that but I still get the same Java version error.

@kermitt2
Copy link
Owner

kermitt2 commented Apr 6, 2019

Ok I think JDK 11 is really very recent (released last September), never tested it. Java 11 is only supported by gradle 5 since last November, so maybe you could try this:
http://services.gradle.org/distributions/gradle-5.3-rc-3-bin.zip

... though that might not be supported by the gradle wrapper...

Otherwise, it is better to use a jdk version "officially" supported by grobid (jdk 1.8 or 10).

@Aazhar
Copy link
Collaborator

Aazhar commented Apr 11, 2019

I've got same issue trying to install grobid on ubuntu 18 that comes with java 10 by default.

@kermitt2
Copy link
Owner

For java 10, normally this works
https://grobid.readthedocs.io/en/latest/Troubleshooting/#wrong-java-version
no?

@Aazhar
Copy link
Collaborator

Aazhar commented Apr 12, 2019

So compiling grobid on ubuntu 18 with the default java version :

openjdk version "10.0.2"

I'm getting an error from jacoco :

Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:510) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:522) Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented. at org.jacoco.agent.rt.internal_932a715.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139) at org.jacoco.agent.rt.internal_932a715.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100) at org.jacoco.agent.rt.internal_932a715.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_932a715.PreMain.premain(PreMain.java:47) ... 6 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.base/java.lang.Class.getField(Class.java:1958) at org.jacoco.agent.rt.internal_932a715.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137) ... 9 more FATAL ERROR in native method: processing of -javaagent failed

So the grobid-core tests are passing after updating jacoco to toolVersion='0.8.2'

Then this error appears regarding jetty apparently:

WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.DataSourceProvider] with an exception: MultiException stack 1 of 2 java.lang.NoClassDefFoundError: javax/activation/DataSource at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3090) at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2316) at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1308) at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1304) at java.base/java.security.AccessController.doPrivileged(Native Method) at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1304) at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1247) at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:83) at

the workaround for this would be to add a dependency (corresponding to the missing package):

compile "javax.activation:activation:1.1.1"

Then another error related to powermock is showing and after updating to latest beta version everything goes fine (without changing gradle version)

@kermitt2
Copy link
Owner

In principle you should not have these issues with OpenJDK 10.0.2
see #342

@kermitt2
Copy link
Owner

or are you testing with distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip ?

@Aazhar
Copy link
Collaborator

Aazhar commented Apr 12, 2019

in fact your description (#342) is another way to workaround missing package issue, but jacoco issue is still persisting, and this happening at the begining of the task grobid-core:test"

I tried with both gradle version without success, it works after updating jacoco to 0.8.2.

then there is another issue happening related to the mocking library that needs to be updated too, I've updated the trouble shooting in the doc.

@kermitt2
Copy link
Owner

I've just pushed da0a8f1 an update of the dependencies and gradle version to support JVM 10 (and lower!) without requiring any additional modifications.
Is it working for you @Aazhar ?

@Aazhar
Copy link
Collaborator

Aazhar commented Apr 16, 2019

@kermitt2 yes everything is good now, thanks
@jonsaadfalcon what about you ?

@kermitt2
Copy link
Owner

Do we still have issues with java version 11 ?

@jonsaadfalcon
Copy link
Author

No not anymore

@kermitt2
Copy link
Owner

thanks a lot @jonsaadfalcon ! let's close the issue.

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

No branches or pull requests

3 participants