Skip to content

Error on OpenJDK 11 #370

@PhilippeVienne

Description

@PhilippeVienne

Test with maven are failing on OpenJDK 11:

... Maven Log Before
[ERROR] testGetIssueDiscussionsByList(org.gitlab4j.api.TestIssueDiscussionsApi)  Time elapsed: 0.077 s  <<< ERROR!
org.mockito.exceptions.base.MockitoException: 
Unable to initialize @Spy annotated field 'response'.

Mockito cannot mock this class: class org.gitlab4j.api.FakeResponse.

Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.


Java               : 11
JVM vendor name    : Oracle Corporation
JVM vendor version : 11.0.3+7-Ubuntu-1ubuntu218.10.1
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 11.0.3+7-Ubuntu-1ubuntu218.10.1
JVM info           : mixed mode, sharing
OS name            : Linux
OS version         : 4.18.0-20-generic


Underlying exception : java.lang.IllegalStateException: Error invoking java.lang.reflect.Method#getAnnotatedReturnType
	at org.gitlab4j.api.TestIssueDiscussionsApi.setUp(TestIssueDiscussionsApi.java:34)
Caused by: org.mockito.exceptions.base.MockitoException: 

Mockito cannot mock this class: class org.gitlab4j.api.FakeResponse.

Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.


Java               : 11
JVM vendor name    : Oracle Corporation
JVM vendor version : 11.0.3+7-Ubuntu-1ubuntu218.10.1
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 11.0.3+7-Ubuntu-1ubuntu218.10.1
JVM info           : mixed mode, sharing
OS name            : Linux
OS version         : 4.18.0-20-generic


Underlying exception : java.lang.IllegalStateException: Error invoking java.lang.reflect.Method#getAnnotatedReturnType
	at org.gitlab4j.api.TestIssueDiscussionsApi.setUp(TestIssueDiscussionsApi.java:34)
Caused by: java.lang.IllegalStateException: Error invoking java.lang.reflect.Method#getAnnotatedReturnType
	at org.gitlab4j.api.TestIssueDiscussionsApi.setUp(TestIssueDiscussionsApi.java:34)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/adapters/XmlAdapter
	at org.gitlab4j.api.TestIssueDiscussionsApi.setUp(TestIssueDiscussionsApi.java:34)

[INFO] Running org.gitlab4j.api.TestGitLabApiBeans
[INFO] Tests run: 64, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.009 s - in org.gitlab4j.api.TestGitLabApiBeans
... Maven Log After

This is due to java.lang.NoClassDefFoundError: javax/xml/bind/annotation/adapters/XmlAdapter and can be solved by adding Java EE classes to test scope for maven. See https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions