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 11 support #20

Open
jskov opened this issue Oct 28, 2018 · 9 comments
Open

Java 11 support #20

jskov opened this issue Oct 28, 2018 · 9 comments

Comments

@jskov
Copy link

jskov commented Oct 28, 2018

To use enunciate with java 11, I had to use the old form of plugin activation, specifying some additional jars:

  dependencies {
    classpath "gradle.plugin.com.webcohesion.enunciate:enunciate-gradle:2.11.1"
	classpath "javax.jws:javax.jws-api:1.1"
	classpath "javax.xml.bind:jaxb-api:2.3.1"
  }
  apply plugin: "com.webcohesion.enunciate"

This was with enunciate modules docs, jaxrs, and jaxbs enabled.

The gradle wrapper should probably be changed to include those dependencies.

Or maybe the maven module com.webcohesion.enunciate:enunciate-top should be?
Do you know, @stoicflame, if something similar is required for Maven and java11?

@stoicflame
Copy link
Owner

I've run the latest version of Enunciate with Java 11 and it works fine with the simple use cases I have. That indicates that the changes need to be included in the gradle wrapper. Yes?

@jskov
Copy link
Author

jskov commented Nov 2, 2018

Sorry for the delay in answering @stoicflame , life interfered.

But when I look here:
https://github.com/stoicflame/enunciate/blob/master/jaxb/src/main/java/com/webcohesion/enunciate/modules/jaxb/JaxbModule.java

The module does use the jaxb-api classes.
Specifically, I get this stacktrace when trying to use the module from the Gradle plugin:

Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlType
        at com.webcohesion.enunciate.modules.jaxb.JaxbModule.typeDetected(JaxbModule.java:214)
        at com.webcohesion.enunciate.EnunciateReflectionsScanner.scan(EnunciateReflectionsScanner.java:107)
        at org.reflections.scanners.AbstractScanner.scan(AbstractScanner.java:35)
        at com.webcohesion.enunciate.EnunciateReflectionsScanner.scan(EnunciateReflectionsScanner.java:91)
        at org.reflections.Reflections.scan(Reflections.java:243)           
        at org.reflections.Reflections.scan(Reflections.java:203)
        at org.reflections.Reflections.<init>(Reflections.java:128)      

So I am pretty sure the enunciate-jaxb should depend on "javax.xml.bind:jaxb-api:2.3.1" (or whichever version it is built with).

Similar for the enunciate-jaxws module which should depend on "javax.jws:javax.jws-api:1.1" (due to its import of javax.jws.WebService).

I could of course add the dependencies to the gradle plugin.
But it is not the gradle plugin that requires those classes. It is the enunciate modules themselves.
So it seems like a hack to do so, in my eyes.

Not sure why this is not an issue with Maven?!

Could it be because the Gradle plugin depends on enunciate-top? Should it be enunciate-parent instead?

@stoicflame
Copy link
Owner

Okay, I've opened stoicflame/enunciate#926 to track the issue.

@piterrivero
Copy link

Hi @stoicflame ... I have the same problem with the enunciate, how you resolved the problem? which dependencies you added? thank a lot for your help

@jskov-jyskebank-dk
Copy link
Collaborator

@piterrivero did you read the original problem text? It contains the workaround...

@piterrivero
Copy link

@jskovjyskebankdk yes I did it! but I'm using maven, so I added these two dependencies javax.jws:javax.jws-api:1.1 and javax.xml.bind:jaxb-api:2.3.1 but however still I have the problem. Thank you!

@stoicflame
Copy link
Owner

@piterrivero, if you're using Maven, you should probably open up a separate issue at enunciate/issues. You'll probably need to provide a way to reproduce the problem as I can't see it on my end.

@darmbrust
Copy link

In building my project with enunciate on JDK 11, I still get these warnings from maven:
[INFO] --- enunciate-maven-plugin:2.11.1:assemble (default) @ uts-rest-api ---
[WARNING] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

Which tells me the enunciate plugin is still pulling in these old dependencies somewhere in its dependency tree. I don't have those anywhere in my code base. (Why oracle published those with broken poms is neither her nor there)

While maven does allow you to add or override versions of dependencies for a plugin, it appears that they never added support for excluding dependencies:

https://issues.apache.org/jira/browse/MNG-2163

It doesn't currently break my build on JDK 11, but I think its something that needs to be fixed in the enunciate plugin itself if we want to fully get rid of these old xml jar files.

I did a maven dependency:tree on the 2.11.1 tag, I found a few refs:

[INFO] ----------< com.webcohesion.enunciate:enunciate-maven-plugin >----------
[INFO] Building Enunciate - Maven Plugin 2.11.1                         [28/39]
[INFO] ----------------------------[ maven-plugin ]----------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ enunciate-maven-plugin ---
[INFO] com.webcohesion.enunciate:enunciate-maven-plugin:maven-plugin:2.11.1
[INFO] +- com.webcohesion.enunciate:enunciate-slim-maven-plugin:maven-plugin:2.11.1:compile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.2.11:compile
[INFO] |  +- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile
[INFO] |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile

Some are like this, you will likely have to ban them in your dependency tree unless the upstream projects have new versions that finally stopped using them:

[INFO] -------< com.webcohesion.enunciate:enunciate-examples-cxf-full >--------
[INFO] Building Enunciate - CXF Full API Example 2.11.1                 [37/39]
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ enunciate-examples-cxf-full ---
[INFO] com.webcohesion.enunciate:enunciate-examples-cxf-full:war:2.11.1
[INFO] +- com.webcohesion.enunciate:enunciate-core-annotations:jar:2.11.1:compile
[INFO] +- com.webcohesion.enunciate:enunciate-rt-util:jar:2.11.1:compile
[INFO] +- org.springframework:spring-web:jar:3.2.14.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.2.14.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.2.14.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:3.2.14.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:3.2.14.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:3.2.14.RELEASE:compile
[INFO] |     \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:3.1.2:compile
[INFO] |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  +- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] |  +- org.apache.cxf:cxf-core:jar:3.1.2:compile
[INFO] |  |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] |  |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] |  |  \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.1.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-wsdl:jar:3.1.2:compile
[INFO] |  |  |  \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] |  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.1.2:compile
[INFO] |  |     +- com.sun.xml.bind:jaxb-impl:jar:2.2.11:compile
[INFO] |  |     \- com.sun.xml.bind:jaxb-core:jar:2.2.11:compile

@KoenDG
Copy link

KoenDG commented Jul 15, 2019

Also running into this problem with openjdk 11, specifically Amazon's corretto:

Using enunciate 2.11.1

Caused by: java.lang.NoClassDefFoundError: javax/jws/WebService
        at com.webcohesion.enunciate.modules.jaxws.JaxwsModule.typeDetected(JaxwsModule.java:255)
        at com.webcohesion.enunciate.EnunciateReflectionsScanner.scan(EnunciateReflectionsScanner.java:107)
        at org.reflections.scanners.AbstractScanner.scan(AbstractScanner.java:35)
        at com.webcohesion.enunciate.EnunciateReflectionsScanner.scan(EnunciateReflectionsScanner.java:91)
        at org.reflections.Reflections.scan(Reflections.java:243)
        at org.reflections.Reflections.scan(Reflections.java:203)
        at org.reflections.Reflections.<init>(Reflections.java:128)
        at com.webcohesion.enunciate.Enunciate.loadApiReflections(Enunciate.java:814)
        at com.webcohesion.enunciate.Enunciate.run(Enunciate.java:565)
        at com.webcohesion.enunciate.EnunciateTask.execute(EnunciateTask.java:154)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        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 org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        ... 94 more
Caused by: java.lang.ClassNotFoundException: javax.jws.WebService
        at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1386)
        at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1335)
        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1090)
        ... 109 more

Adding these(as seen here: stoicflame/enunciate#926 (comment)) does not help:

    compile group: 'javax.xml.ws', name: 'jaxws-api', version: '2.3.1'
    compile group: 'javax.jws', name: 'javax.jws-api', version: '1.1'
    compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'

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

6 participants