4

Let's start with a wadl-client-plugin configuration that works properly on Java 8 (provided that I added a jaxp.properties file inside the JDK as documented here):

<plugin>
  <groupId>org.jvnet.ws.wadl</groupId>
  <artifactId>wadl-client-plugin</artifactId>
  <version>1.1.6</version>
  <executions>
    <execution>
      <goals>
        <goal>generate</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <targets>
      <target>http://127.0.0.1:8080/sigb/rest/application.wadl</target>
    </targets>
    <packageName>sigb.ws</packageName>
    <autopackaging>true</autopackaging>
    <customizations>
      <customization>${basedir}/src/main/resources/bindings.xjb</customization>
    </customizations>
    <customClassNames>
      <property>
        <name>http://127.0.0.1:8080/sigb/rest/</name>
        <value>SigbWsClient</value>
      </property>
    </customClassNames>
    <generationStyle>jaxrs20</generationStyle>
  </configuration>
</plugin>

As may be guessed from above, my WADL is generated by Jersey, which is the supporting framework I used to develop my REST application.

When switching to Java 9 or 10, of course I have to add dependencies for JAXB, which isn't available anymore by default. I added the following to the above configuration:

<dependencies>
  <dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
  </dependency>
  <dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>2.3.0.1</version>
  </dependency>
</dependencies>

Now JAXB fails because of the namespace Jersey (rightfully) includes in the WADL it generates. The error is described as follows (I translated the messages from French, so they may not exactly match their original English version):

[ERROR] Failed to execute goal org.jvnet.ws.wadl:wadl-client-plugin:1.1.6:generate (default) on project sigbws-bul-ws-client: Failed to generate sources from http://127.0.0.1:8080/sigb/rest/application.wadl. Internal error: unexpected element (URI : "http://wadl.dev.java.net/2009/02", local : "application"). Expected elements are <{}application>,<{}doc>,<{}grammars>,<{}include>,<{}link>,<{}method>,<{}option>,<{}param>,<{}representation>,<{}request>,<{}resource>,<{}resource_type>,<{}resources>,<{}response> -> [Help 1]

If anyone has a clue about this bug, any help will be greatly appreciated.

Thanks in advance...

Jeff Morin
  • 1,010
  • 1
  • 13
  • 25
  • Have you figured out how to fix the problem? – Vitalii Jun 11 '21 at 10:42
  • 1
    Not yet, but I gave up this path since then. I plan to give it a try with Java 16 or 17 in a near future. If I find anything new, I will post it in this page. – Jeff Morin Jun 21 '21 at 18:11

1 Answers1

0

I had this issue on GitLab pipeline while locally everything was ok. In the pipeline a docker image created by our ops guys was used. Code is downloaded from gitlab inside this image and built there.

I tried to upload the code to the docker alpine image with manually installed jdk11 and maven. Build worked in this case.

Than ops guys who created this image checked it and told me that some maven dependencies were not allowed due to corporate policies and when they allowed all, it became ok. Unfortunately I wasn't told the exact dependency name but hope that this direction will be helpful.

Vitalii
  • 10,091
  • 18
  • 83
  • 151