Below is my pom.xml for to do wsimport
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dat</groupId>
<artifactId>digsig</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>digsig</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-xjc -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.9</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<!-- Following configuration will pass all XML files from ${basedir}/src/bindings to wsimport. -->
<configuration>
<bindingDirectory>${basedir}/src</bindingDirectory>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<wsdlUrls>
<wsdlUrl>http://webservice.server/Services/InvoiceService.asmx?WSDL</wsdlUrl>
</wsdlUrls>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Build is failing with below error
[DEBUG] Importing foreign packages into class realm plugin>org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3
[DEBUG] Included: org.jvnet.jax-ws-commons:jaxws-maven-plugin:jar:2.3
[DEBUG] Included: com.sun.xml.ws:jaxws-tools:jar:2.2.8
[DEBUG] Included: org.jvnet.jaxb2_commons:jaxb2-basics:jar:0.6.4
[DEBUG] Included: org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.6.4
[DEBUG] Included: org.jvnet.jaxb2_commons:jaxb2-basics-tools:jar:0.6.4
[DEBUG] Included: commons-beanutils:commons-beanutils:jar:1.7.0
[DEBUG] Included: commons-lang:commons-lang:jar:2.2
[DEBUG] Included: commons-logging:commons-logging:jar:1.1.1
[DEBUG] Included: com.google.code.javaparser:javaparser:jar:1.0.8
[DEBUG] Included: backport-util-concurrent:backport-util-concurrent:jar:3.1
[DEBUG] Included: org.codehaus.plexus:plexus-interpolation:jar:1.11
[DEBUG] Included: junit:junit:jar:3.8.1
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG] Included: org.sonatype.sisu:sisu-inject-bean:jar:2.3.0
[DEBUG] Included: org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0
[DEBUG] Included: org.sonatype.sisu:sisu-guava:jar:0.9.9
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.10
[DEBUG] Configuring mojo org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport from plugin realm ClassRealm[plugin>org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3, parent: sun.misc.Launcher$AppClassLoader@55f96302]
[DEBUG] Configuring mojo 'org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport' with basic configurator -->
[DEBUG] (f) bindingDirectory = D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\src
[DEBUG] (f) destDir = D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\classes
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) extension = false
[DEBUG] (f) genJWS = false
[DEBUG] (f) implDestDir = D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\src\main\java
[DEBUG] (f) keep = true
[DEBUG] (f) localRepository = id: local
url: file:///c:/tools/maven/repository/
layout: default
snapshots: [enabled => true, update => always]
releases: [enabled => true, update => always]
[DEBUG] (f) pluginArtifactMap = {org.jvnet.jax-ws-commons:jaxws-maven-plugin=org.jvnet.jax-ws-commons:jaxws-maven-plugin:maven-plugin:2.3:, com.sun.xml.ws:jaxws-tools=com.sun.xml.ws:jaxws-tools:jar:2.2.8:compile, org.jvnet.jaxb2_commons:jaxb2-basics=org.jvnet.jaxb2_commons:jaxb2-basics:jar:0.6.4:compile, org.jvnet.jaxb2_commons:jaxb2-basics-runtime=org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.6.4:compile, org.jvnet.jaxb2_commons:jaxb2-basics-tools=org.jvnet.jaxb2_commons:jaxb2-basics-tools:jar:0.6.4:compile, commons-beanutils:commons-beanutils=commons-beanutils:commons-beanutils:jar:1.7.0:compile, commons-lang:commons-lang=commons-lang:commons-lang:jar:2.2:compile, commons-logging:commons-logging=commons-logging:commons-logging:jar:1.1.1:compile, com.google.code.javaparser:javaparser=com.google.code.javaparser:javaparser:jar:1.0.8:compile, org.apache.maven:maven-project=org.apache.maven:maven-project:jar:2.2.1:compile, org.apache.maven:maven-settings=org.apache.maven:maven-settings:jar:2.2.1:compile, org.apache.maven:maven-profile=org.apache.maven:maven-profile:jar:2.2.1:compile, org.apache.maven:maven-model=org.apache.maven:maven-model:jar:2.2.1:compile, org.apache.maven:maven-artifact-manager=org.apache.maven:maven-artifact-manager:jar:2.2.1:compile, org.apache.maven:maven-repository-metadata=org.apache.maven:maven-repository-metadata:jar:2.2.1:compile, backport-util-concurrent:backport-util-concurrent=backport-util-concurrent:backport-util-concurrent:jar:3.1:compile, org.apache.maven:maven-plugin-registry=org.apache.maven:maven-plugin-registry:jar:2.2.1:compile, org.codehaus.plexus:plexus-interpolation=org.codehaus.plexus:plexus-interpolation:jar:1.11:compile, org.apache.maven:maven-artifact=org.apache.maven:maven-artifact:jar:2.2.1:compile, org.codehaus.plexus:plexus-container-default=org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile, junit:junit=junit:junit:jar:3.8.1:compile, classworlds:classworlds=classworlds:classworlds:jar:1.1-alpha-2:compile, org.apache.maven:maven-plugin-api=org.apache.maven:maven-plugin-api:jar:3.0.5:compile, org.sonatype.sisu:sisu-inject-plexus=org.sonatype.sisu:sisu-inject-plexus:jar:2.3.0:compile, org.codehaus.plexus:plexus-component-annotations=org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:compile, org.codehaus.plexus:plexus-classworlds=org.codehaus.plexus:plexus-classworlds:jar:2.4:compile, org.sonatype.sisu:sisu-inject-bean=org.sonatype.sisu:sisu-inject-bean:jar:2.3.0:compile, org.sonatype.sisu:sisu-guice=org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile, org.sonatype.sisu:sisu-guava=org.sonatype.sisu:sisu-guava:jar:0.9.9:compile, org.codehaus.plexus:plexus-utils=org.codehaus.plexus:plexus-utils:jar:3.0.10:compile}
[DEBUG] (f) quiet = false
[DEBUG] (f) remoteRepositories = [ id: nexus
url: http://passport-nexus/nexus/content/groups/public
layout: default
snapshots: [enabled => false, update => daily]
releases: [enabled => true, update => never]
]
[DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@78e89bfe
[DEBUG] (f) sourceDestDir = D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\generated-sources\wsimport
[DEBUG] (f) staleFile = D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\jaxws\stale
[DEBUG] (f) verbose = false
[DEBUG] (f) vmArgs = [-Djavax.xml.accessExternalSchema=all]
[DEBUG] (f) wsdlDirectory = D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\src\wsdl
[DEBUG] (f) wsdlUrls = [http://webservice.server/Services/InvoiceService.asmx?WSDL]
[DEBUG] (f) xadditionalHeaders = false
[DEBUG] (f) xdebug = false
[DEBUG] (f) xdisableAuthenticator = false
[DEBUG] (f) xdisableSSLHostnameVerification = false
[DEBUG] (f) xnoAddressingDataBinding = false
[DEBUG] (f) xnocompile = true
[DEBUG] (f) xuseBaseResourceAndURLToLoadWSDL = false
[DEBUG] (f) project = MavenProject: com.dat:digsig:0.0.1-SNAPSHOT @ D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\pom.xml
[DEBUG] -- end configuration --
[DEBUG] The wsdl Directory is D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\src\wsdl
[DEBUG] The binding Directory is D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\src
[INFO] Processing: http://webservice.server/Services/InvoiceService.asmx?WSDL
[DEBUG] adding src root: D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\generated-sources\wsimport
[DEBUG] The binding Directory is D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\src
[DEBUG] jaxws:wsimport args: [-keep, -s, D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\generated-sources\wsimport, -d, D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\classes, -encoding, UTF-8, -Xnocompile]
[INFO] jaxws:wsimport args: [-keep, -s, D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\generated-sources\wsimport, -d, D:\Dev\Eclipse_Workspace\Neon\WebService_Demo\digsig\target\classes, -encoding, UTF-8, -Xnocompile, "http://webservice.server/Services/InvoiceService.asmx?WSDL"]
[DEBUG] dummy:dummy:jar:1.0 (selected for null)
[WARNING] Failed to build parent project for com.sun.xml.ws:project:pom:2.2.8
[WARNING] Failed to build parent project for com.sun.xml.ws:bundles:pom:2.2.8
[WARNING] Failed to build parent project for com.sun.xml.ws:jaxws-tools:pom:2.2.8
[WARNING] Invalid POM for com.sun.xml.ws:jaxws-tools:jar:2.2.8, transitive dependencies (if any) will not be available, enable debug logging for more details: Some problems were encountered while processing the POMs:
[ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} @ com.sun.xml.ws:jaxws-ri-bom:2.2.8, c:\tools\maven\repository\com\sun\xml\ws\jaxws-ri-bom\2.2.8\jaxws-ri-bom-2.2.8.pom, line 395, column 29
[DEBUG] com.sun.xml.ws:jaxws-tools:jar:2.2.8:compile (selected for compile)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.747 s
[INFO] Finished at: 2017-02-27T16:47:38-06:00
[INFO] Final Memory: 12M/364M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport (default) on project digsig: Execution default of goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport failed: String index out of range: -1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport (default) on project digsig: Execution default of goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport failed: String index out of range: -1
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport failed: String index out of range: -1
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.AbstractStringBuilder.substring(Unknown Source)
at java.lang.StringBuilder.substring(Unknown Source)
at org.jvnet.jax_ws_commons.jaxws.AbstractJaxwsMojo.getCP(AbstractJaxwsMojo.java:484)
at org.jvnet.jax_ws_commons.jaxws.AbstractJaxwsMojo.exec(AbstractJaxwsMojo.java:359)
at org.jvnet.jax_ws_commons.jaxws.WsImportMojo.processWsdlViaUrls(WsImportMojo.java:342)
at org.jvnet.jax_ws_commons.jaxws.WsImportMojo.execute(WsImportMojo.java:282)
at org.jvnet.jax_ws_commons.jaxws.MainWsImportMojo.execute(MainWsImportMojo.java:50)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
can someone help me to fix this issue?
I fixed this error by simply downgrading the JDK version I was using. Right-click on your project > Properties > Build > Compile > Java Platform > Set it to JDK 1.8.
Sometimes it will happen because of class not found exception(click wsgen error and then you can see more details- check from which point build failed) Check the class in sei tag (in pom.xml) refers to the correct service. it should point the correct path from the source(src). This corrected my issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With