question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalArgumentException: Prefix '' is already bound to '' on jdk11

See original GitHub issue

The goal of com.oracle.weblogic:weblogic-maven-plugin:12.3.1-0-0:ws-jwsc is failed on jdk11 with following exception.

Caused by: java.lang.IllegalArgumentException: Prefix '' is already bound to '' at com.sun.xml.txw2.StartTag.addNamespaceDecl (StartTag.java:191) at com.sun.xml.txw2.ContainerElement._namespace (ContainerElement.java:333) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at com.sun.xml.txw2.ContainerElement.invoke (ContainerElement.java:134) at com.sun.proxy.$Proxy41._namespace (Unknown Source) at com.sun.xml.ws.wsdl.writer.WSDLGenerator.generateDocument (WSDLGenerator.java:394) at com.sun.xml.ws.wsdl.writer.WSDLGenerator.doGeneration (WSDLGenerator.java:316) at weblogic.wsee.tools.jws.jaxws.JAXWSProcessor.generateWsdl (JAXWSProcessor.java:335) at weblogic.wsee.tools.jws.jaxws.JAXWSProcessor.generateWsdl (JAXWSProcessor.java:242) at weblogic.wsee.tools.jws.jaxws.JAXWSProcessor.finish (JAXWSProcessor.java:227) at weblogic.wsee.tools.jws.process.CompositeProcessor.finish (CompositeProcessor.java:59) at weblogic.wsee.tools.jws.build.JwsCompiler.buildWebServices (JwsCompiler.java:546) at weblogic.wsee.tools.jws.build.JwsCompiler.compile (JwsCompiler.java:503) at weblogic.wsee.tools.anttasks.JwsModule.generate (JwsModule.java:442) at weblogic.wsee.tools.anttasks.JwsModule.build (JwsModule.java:306) at weblogic.wsee.tools.anttasks.JwscTask.execute (JwscTask.java:242) at weblogic.tools.maven.plugins.webservices.JwscMojo.execute (JwscMojo.java:156) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) ...

And the issue is caused by the following code: package com.sun.xml.ws.wsdl.writer //jaxws 2.3.0.2v and jaxb 2.3.0.1v
public class WSDLGenerator { ... private void generateDocument(XmlSerializer serviceStream, XmlSerializer portStream) { serviceDefinitions = TXW.create(Definitions.class, serviceStream); //Line#1 serviceDefinitions._namespace(WSDL_NAMESPACE, "");//WSDL_PREFIX); //Line#2 serviceDefinitions._namespace(XSD_NAMESPACE, XSD_PREFIX); serviceDefinitions.targetNamespace(model.getServiceQName().getNamespaceURI()); serviceDefinitions._namespace(model.getServiceQName().getNamespaceURI(), TNS_PREFIX); ... } ... }

The empty namespace can be bound to the empty prefix in implementation of jaxb. If empty namespace is bound to the empty prefix in Line#1, the IllegalArgumentException will be thrown. Because WSDL_NAMESPACE (http://schemas.xmlsoap.org/wsdl/) also attempts to bind to the empty prefix in Line#2.

This issue only happens on jdk9 and later versions.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
bravehorsiecommented, Oct 9, 2018

Looks to be caused by maven classloading in the context of maven plugin goal execution. Incorrect usage of empty prefix is caused by incorrect empty namespace URI which in turn is caused by not loading package-info.class which contains the URI declaration. For example see here I have filed a https://github.com/codehaus-plexus/plexus-classworlds/issues/3

1reaction
gurglcommented, Apr 25, 2019

I’ve tested with maven 3.6.1 and now org.codehaus.mojo:jaxb2-maven-plugin works as I hoped it would. Thanks for pinpointing this issue which ate a good bunch of hours.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.IllegalArgumentException: Prefix '' is already bound ...
Thread.run(Thread.java:662) Caused by: java.lang.IllegalArgumentException: Prefix '' is already bound to '' at com.sun.xml.txw2.StartTag.
Read more >
A brand new website interface for an even better experience!
java.lang.IllegalArgumentException: Prefix '' is already bound to '' on jdk11.
Read more >
Mavenjaxb2Plugin Reports Prefix Is Already Bound Only In ...
Another way to fix this problem is to use the simpler and better binding mode in XJC which is a JAXB RI vendor...
Read more >
JAX-WS and Prefix '' is already bound to '' - CodeRanch
Hello. I have problem with my JAX-WS server and deployment it to tomcat 6. I used this tutorial http://java.dzone.com/articles/jax-ws-deployment ...
Read more >
XMLOutputFactory (Java SE 11 & JDK 11 )
This method has been deprecated because it returns an instance of XMLInputFactory, which is of the wrong class. Use the new method newFactory(java.lang.String, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found