eclipse-ee4j / metro-jax-ws

metro-jax-ws
https://eclipse-ee4j.github.io/metro-jax-ws/
BSD 3-Clause "New" or "Revised" License
68 stars 40 forks source link

wsimport maven plugin 4.0.2 - wsdl file not found when running in gitlab #689

Open dzonekl opened 3 weeks ago

dzonekl commented 3 weeks ago

Hi,

I have a project which uses wsimport using the maven plugin [1] When running locally with maven 3.8.5, the wsimport goal succeeds (java17-oracle), when running in gitlab it fails. Gitlab runs with java17-jdk docker base image.

The error [2] in gitlab shows : `The wsdl File is 'Nlets.wsdl' from 'null' while the .wsdl file property is set

[DEBUG]   (f) wsdlDirectory = /go/src/gitlab.com/SensysGatso/sggms/xilium/nlets/src/main/resources
[DEBUG]   (f) wsdlFiles = [Nlets.wsdl]

Prior to running the mvn clean verify I dump the content of the directory, showing the file is present.

$ ls src/main/resources application-dev.yml application.yml CreateDatabase.sql NLetsRequest.xml NLets.wsdl

In which case would the error `The wsdl File is ... from null" be issued ? Is there a way to further troubleshoot this issue ? Are there known issues with specific Java 17 JDK's ?

TIA Christophe

[1]

jaxws.version=4.0.2

 <plugin>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>${jaxws.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <packageName>org.nlets</packageName>
                    <wsdlDirectory>${project.basedir}/src/main/resources/</wsdlDirectory>
                    <xdebug>true</xdebug>
                </configuration>
            </plugin>

[2]

<configuration>
  <bindingDirectory default-value="${basedir}/src/jaxws"/>
  <destDir default-value="${project.build.outputDirectory}"/>
  <disableXmlSecurity default-value="false"/>
  <encoding>${project.build.sourceEncoding}</encoding>
  <extension default-value="false"/>
  <genJWS default-value="false"/>
  <implDestDir default-value="${project.build.sourceDirectory}"/>
  <keep default-value="true"/>
  <packageName>org.nlets</packageName>
  <pluginDescriptor default-value="${plugin}"/>
  <pluginRepos default-value="${project.remotePluginRepositories}"/>
  <project default-value="${project}"/>
  <projectRepos default-value="${project.remoteProjectRepositories}"/>
  <quiet default-value="false"/>
  <repoSession default-value="${repositorySystemSession}"/>
  <settings>${settings}</settings>
  <sourceDestDir default-value="${project.build.directory}/generated-sources/wsimport"/>
  <staleFile default-value="${project.build.directory}/jaxws/stale"/>
  <verbose default-value="false"/>
  <wsdlDirectory default-value="${basedir}/src/wsdl">/go/src/gitlab.com/SensysGatso/sggms/xilium/nlets/src/main/resources/</wsdlDirectory>
  <wsdlFiles>
    <wsdlFile>Nlets.wsdl</wsdlFile>
  </wsdlFiles>
  <xadditionalHeaders default-value="false"/>
  <xdebug default-value="false">true</xdebug>
  <xdisableAuthenticator default-value="false"/>
  <xdisableSSLHostnameVerification default-value="false"/>
  <xnoAddressingDataBinding default-value="false"/>
  <xnocompile default-value="true"/>
  <xuseBaseResourceAndURLToLoadWSDL default-value="false"/>
</configuration>
[DEBUG]   (f) pluginRepos = [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG]   (f) project = MavenProject: nl.ambrero:nlets:1.8.57-SNAPSHOT @ /go/src/gitlab.com/SensysGatso/sggms/xilium/nlets/pom.xml
[DEBUG]   (f) projectRepos = [gitlab-maven (https://gitlab.com/api/v4/groups/5665805/-/packages/maven, default, releases+snapshots), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG]   (f) quiet = false
[DEBUG]   (f) repoSession = org.eclipse.aether.DefaultRepositorySystemSession@221b77d7
[DEBUG]   (f) settings = org.apache.maven.execution.SettingsAdapter@3d24420b
[DEBUG]   (f) sourceDestDir = /go/src/gitlab.com/SensysGatso/sggms/xilium/nlets/target/generated-sources/wsimport
[DEBUG]   (f) staleFile = /go/src/gitlab.com/SensysGatso/sggms/xilium/nlets/target/jaxws/stale
[DEBUG]   (f) verbose = false
[DEBUG]   (f) wsdlDirectory = /go/src/gitlab.com/SensysGatso/sggms/xilium/nlets/src/main/resources
[DEBUG]   (f) wsdlFiles = [Nlets.wsdl]
[DEBUG]   (f) xadditionalHeaders = false
[DEBUG]   (f) xdebug = true
[DEBUG]   (f) xdisableAuthenticator = false
[DEBUG]   (f) xdisableSSLHostnameVerification = false
[DEBUG]   (f) xnoAddressingDataBinding = false
[DEBUG]   (f) xnocompile = true
[DEBUG]   (f) xuseBaseResourceAndURLToLoadWSDL = false
[DEBUG] -- end configuration --
[DEBUG] The wsdl File is 'Nlets.wsdl' from 'null'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:11 min
[INFO] Finished at: 2024-06-12T07:37:44Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.sun.xml.ws:jaxws-maven-plugin:4.0.2:wsimport (default) on project nlets: 'Nlets.wsdl' not found. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.sun.xml.ws:jaxws-maven-plugin:4.0.2:wsimport (default) on project nlets: 'Nlets.wsdl' not found.
DaScheid commented 2 weeks ago

Searching for parts of the error message, shows that it originates from here: https://github.com/eclipse-ee4j/metro-jax-ws/blob/e72999c71eef4d6bf828c67a7d7a402e371c4c8e/jaxws-ri/extras/jaxws-maven-plugin/src/main/java/org/jvnet/jax_ws_commons/jaxws/WsImportMojo.java#L521-L541 There are two possibilities for toAdd to get a value assigned, either via resource-loading or by converting the file-object to an url. The error message states, that the final result of toAdd is null and a quick look at toURI() and toURL shows null being an unlikely result of these method-calls. Therefore, assuming the "files-does-not-exist"-check (!wsdl.exists()) succeeds, leading to an resource-loading attempt with an URLClassloader, that scans your dependencies for the wsdl-file (which most likely won't find anything resulting in a result of null).

Was able to reconstruct the error-message locally by referencing a wsdl-directory, which does not exist at all (e.g. typo in the path - which isn't the case here, but might help narrowing it down).

A wild guess in the blue: are the file-permissions set in a way that the maven process is allowed to access the wsdl-file? Assuming that the ls-command is executed by a different process.

dzonekl commented 3 days ago

I managed to fix the issue by specifying the file explictly, and also have the correct case for the filename, as it was case sensitive. It did work on Mac (local) but not on Linux (gitlab runner image) with incorrect file case: Nlets.wsdl vs NLets.wsdl ('L' being capital and hard to spot difference).

It feels like a bug as, it did work on one env and not on the other, but we know JVM File API is OS dependent so, with Mvn build on this, not sure this can be tackled by a plugin.