Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

jaxws-maven-plugin - wsimport didn't respect symlinks #122

Open
glassfishrobot opened this issue Jan 14, 2014 · 7 comments
Open

jaxws-maven-plugin - wsimport didn't respect symlinks #122

glassfishrobot opened this issue Jan 14, 2014 · 7 comments

Comments

@glassfishrobot
Copy link
Contributor

Hi all

I encountered a nasty problem with jaxws-maven-plugin 2.3 while doing wsimport :

DEBUG] /bin/sh -c cd /var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace && /opt/mycorp/jvm/java-1.7.0-sun-x64/jre/bin/java -Xbootclasspath/p:/var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/.repository/javax/annotation/javax.annotation-api/1.2-b03/javax.annotation-api-1.2-b03.jar:/var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/.repository/javax/jws/jsr181-api/1.0-MR1/jsr181-api-1.0-MR1.jar:/var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/.repository/javax/xml/ws/jaxws-api/2.2.9/jaxws-api-2.2.9.jar:/var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/.repository/javax/xml/soap/saaj-api/1.3.4/saaj-api-1.3.4.jar:/var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/.repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar -cp /var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/.repository/org/jvnet/jax-ws-commons/jaxws-maven-plugin/2.3/jaxws-maven-plugin-2.3.jar org.jvnet.jax_ws_commons.jaxws.Invoker com.sun.tools.ws.wscompile.WsimportTool -pathfile /tmp/jax-ws-mvn-plugin-cp1417406995290338137.txt -keep -s /var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/target/generated-sources/wsimport -d /var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/target/classes -encoding UTF-8 -Xnocompile -b /var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/src/main/resources/bindings.xml file:/var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/src/main/resources/EPCglobal-epcis-query-1_0.wsdl
parsing WSDL...

[ERROR] "file:/media/ext4/mycorp/cijenkins/jobs/jaxws-issue/workspace/src/main/resources/EPCglobal-epcis-masterdata-1_0.xsd" is not a part of this compilation. Is this a mistake for "file:/var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/src/main/resources/EPCglobal-epcis-masterdata-1_0.xsd"?
  line 5 of file:/media/ext4/mycorp/cijenkins/jobs/jaxws-issue/workspace/src/main/resources/bindings.xml

Exception in thread "main" com.sun.tools.ws.wscompile.AbortException
	at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:144)
	at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298)
	at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198)
	at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141)
	at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444)
	at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:205)
	at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.jvnet.jax_ws_commons.jaxws.Invoker.main(Invoker.java:73)

plugin complains about /media/ext4/mycorp/cijenkins/jobs/jaxws-issue/workspace/src/main/resources/EPCglobal-epcis-masterdata-1_0.xsd" not a part of this compilation, expecting /var/lib/mycorp/cijenkins/jobs/jaxws-issue/workspace/src/main/resources/EPCglobal-epcis-masterdata-1_0.xsd

/var/lib/mycorp/cijenkins is a symlink to /media/ext4/mycorp/cijenkins

It seems file comparaison is using AbsolutePath instead of CanonicalPath.

Environment

openSUSE 12.2, Java 7u45, Maven 3.0.5

Affected Versions

[2.3]

@glassfishrobot
Copy link
Contributor Author

Reported by henri_gomez

@glassfishrobot
Copy link
Contributor Author

[email protected] said:
While using org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3 we experienced the same Stacktrace and abort of WsImport:

**POM config (part)**..
<build>
	<plugins>
		<plugin>
			<groupId>org.jvnet.jax-ws-commons</groupId>
			<artifactId>jaxws-maven-plugin</artifactId>
			<version>2.3</version>
			<executions>
				...
				<execution>
					<id>publication_v1_1</id>
					<goals>
						<goal>wsimport</goal>
					</goals>
					<configuration>
						<sourceDestDir>${project.build.directory}/generated-sources/jaxws</sourceDestDir>
						<wsdlDirectory>${basedir}/src/wsdl/service</wsdlDirectory>
						<bindingDirectory>${basedir}/src/wsdl/binding/transparency/tso</bindingDirectory>
						<verbose>true</verbose>
						<wsdlFiles>
							<wsdlFile>transparency/tso/PublicationService-1_1.wsdl</wsdlFile>
						</wsdlFiles>
						<verbose>true</verbose>
						<target>2.0</target>			
					</configuration>
				</execution>
				...

In contrast to other executions of goal "wsimport" the extract above uses another argument bindingDirectory than the default.

This is the only execution that fails to build with Maven 3.2.2 and JDK6, while 5 other executions run successfully.

@glassfishrobot
Copy link
Contributor Author

[email protected] said:
Regarding possible absolute / canonical issues I fixed wsdl file handling in org.jvnet.jax_ws_commons.jaxws.WsImportMojo.getWSDLFiles().

Submitting the patch (to version 2.3) as part of the comment because attachments are not enabled:

**possiblePatch**Index: src/main/java/org/jvnet/jax_ws_commons/jaxws/WsImportMojo.java
===================================================================
--- src/main/java/org/jvnet/jax_ws_commons/jaxws/WsImportMojo.java	(revision 1185)
+++ src/main/java/org/jvnet/jax_ws_commons/jaxws/WsImportMojo.java	(working copy)
@@ -523,7 +523,7 @@
      * 
      * @return An array of schema files to be parsed by the schema compiler.
      */
-    private URL[] getWSDLFiles() throws MojoExecutionException {
+    private URL[] getWSDLFiles() throws MojoExecutionException, IOException {
         List<URL> files = new ArrayList<URL>();
         @SuppressWarnings("unchecked")
         Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts();
@@ -551,6 +551,9 @@
 if (!wsdl.isAbsolute()) {
     wsdl = new File(wsdlDirectory, wsdlFileName);
 }
+
+wsdl = wsdl.getCanonicalFile();
+
 if (!wsdl.exists()) {
     toAdd = loader.getResource(wsdlFileName);
 } else {

@glassfishrobot
Copy link
Contributor Author

vojtech_k said:
If you face this problem in Jenkins, you can use the following workaround:

  1. Go to project's configuration, section Build.
  2. Check "Use Custom Workspace" and enter the physical project's location in the Directory field.

@glassfishrobot
Copy link
Contributor Author

didierl said:
We were also having the issue on Jenkins with jaxb2-maven-plugin v1.5 and a custom bindings file (either in the same folder, or in a sibling folder but referencing the xsd with a relative path). The workaround from Vojtech_K worked for us.

The strangest thing is that there was no issue when building from the command line.

BTW, this issue might be related to JAX_WS-1147.

@glassfishrobot
Copy link
Contributor Author

This issue was imported from java.net JIRA JAX_WS_COMMONS-122

@tech-consortium
Copy link

tech-consortium commented Aug 3, 2022

This is still an issue even in the latest 4.0.0 version. The build only seems to fail when run in Jenkins. /home/bld is a symlink to /app1/home/bld. We tried the suggestion above of setting the custom workdir, but it didn't fix it.

20:51:29 [INFO] --- jaxws-maven-plugin:4.0.0:wsimport (SubmissionService) @ services-client ---
20:51:29 [INFO] Processing: file:/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/target/wsdl/META-INF/wsdl/SubmissionService.wsdl
20:51:29 [INFO] jaxws:wsimport args: [-keep, -s, '/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/target/generated-sources/wsimport', -d, '/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/target/classes', -verbose, -encoding, ISO-8859-1, -Xnocompile, -p, com.txdot..service.agency.ws.crashsubmission.client, -target, 3.0, -b, '/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/src/main/resources/jaxws/SubmissionServiceDataBinding.xml', "file:/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/target/wsdl/META-INF/wsdl/SubmissionService.wsdl"]
20:51:29 parsing WSDL...
20:51:29 [ERROR] "file:/app1/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/target/wsdl/META-INF/wsdl/SubmissionService_schema1.xsd" is not a part of this compilation. Is this a mistake for "file:/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/target/wsdl/META-INF/wsdl/SubmissionService_schema1.xsd"?
20:51:29 line 4 of file:/app1/home/bld/devtools/jenkins/workspace/trunk-nightly/services/services-client/src/main/resources/jaxws/SubmissionServiceDataBinding.xml
20:51:29
20:51:29 Exception in thread "main" java.lang.reflect.InvocationTargetException
20:51:29 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
20:51:29 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
20:51:29 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
20:51:29 at java.base/java.lang.reflect.Method.invoke(Method.java:568)
20:51:29 at org.jvnet.jax_ws_commons.jaxws.Invoker.main(Invoker.java:74)
20:51:29 Caused by: com.sun.tools.ws.wscompile.AbortException
20:51:29 at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:114)
20:51:29 at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2265)
20:51:29 at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:164)
20:51:29 at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:111)
20:51:29 at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:413)
20:51:29 at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:180)
20:51:29 at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:158)
20:51:29 ... 5 more

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants