New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gaoyan-gao opened this Issue Sep 27, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@gaoyan-gao
Member

gaoyan-gao commented Sep 27, 2018

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.

@jesperdj

This comment has been minimized.

Show comment
Hide comment

jesperdj commented Sep 30, 2018

@bravehorsie

This comment has been minimized.

Show comment
Hide comment
@bravehorsie

bravehorsie Oct 5, 2018

Contributor

Looks like something is passing empty namespace URL (which causes it to be bound to empty prefix) before WSDL_NAMESPACE is added to default namespace / empty prefix.

Is there any reproducer for this issue?

Contributor

bravehorsie commented Oct 5, 2018

Looks like something is passing empty namespace URL (which causes it to be bound to empty prefix) before WSDL_NAMESPACE is added to default namespace / empty prefix.

Is there any reproducer for this issue?

@lennartj

This comment has been minimized.

Show comment
Hide comment
@lennartj

lennartj Oct 8, 2018

I have found this empty namespace URL prefix to be a really problematic issue.

Basically, we need to perform XML transformations after a schemagen XSD generation to rename product schema files, and hence the tooling expects that the element (including its namespace) be constant.

I took the liberty of reporting this issue here as well: see #1223

lennartj commented Oct 8, 2018

I have found this empty namespace URL prefix to be a really problematic issue.

Basically, we need to perform XML transformations after a schemagen XSD generation to rename product schema files, and hence the tooling expects that the element (including its namespace) be constant.

I took the liberty of reporting this issue here as well: see #1223

@bravehorsie

This comment has been minimized.

Show comment
Hide comment
@bravehorsie

bravehorsie Oct 9, 2018

Contributor

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 codehaus-plexus/plexus-classworlds#3

Contributor

bravehorsie commented 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 codehaus-plexus/plexus-classworlds#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment