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.

Code generation fails with "Prefix '' is already bound to ''" when episode generation is on on Java 9

See original GitHub issue

On Java 9 with episode generation turned on, code generation fails:

[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb23-plugin:0.13.3-SNAPSHOT:generate (generate) on project maven-jaxb2-plugin-tests-java-9: Execution generate of goal org.jvnet.jaxb2.maven2:maven-jaxb23-plugin:0.13.3-SNAPSHOT:generate failed: Prefix '' is already bound to '' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb23-plugin:0.13.3-SNAPSHOT:generate (generate) on project maven-jaxb2-plugin-tests-java-9: Execution generate of goal org.jvnet.jaxb2.maven2:maven-jaxb23-plugin:0.13.3-SNAPSHOT:generate failed: Prefix '' is already bound to ''
	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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	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 generate of goal org.jvnet.jaxb2.maven2:maven-jaxb23-plugin:0.13.3-SNAPSHOT:generate failed: Prefix '' is already bound to ''
	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.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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.xml.txw2.ContainerElement.invoke(ContainerElement.java:134)
	at com.sun.proxy.$Proxy46._namespace(Unknown Source)
	at com.sun.tools.xjc.addon.episode.PluginImpl.run(PluginImpl.java:174)
	at com.sun.tools.xjc.model.Model.generateCode(Model.java:292)
	at org.jvnet.mjiip.v_2_3.XJC23Mojo.generateCode(XJC23Mojo.java:66)
	at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute(XJC23Mojo.java:41)
	at org.jvnet.mjiip.v_2_3.XJC23Mojo.doExecute(XJC23Mojo.java:28)
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:473)
	at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:317)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	... 21 more

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
mw84367commented, Nov 11, 2018

It seems that XJC has a bug. When I provide an additional dummy XML schema without the normal header <xs:schema targetNamespace="my.namespace" elementFormDefault="qualified" xmlns="my.namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema">

,i.e. the “targetNamespace”, “elementFormDefault” and “xmlns” attributes, the error is gone.

Thus one just need to add a dummy XSD file like <xs:schema id="Dummy" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Dummy"> <xs:complexType> <xs:sequence> <xs:element name="test"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

and it works. 😃

2reactions
highsourcecommented, May 7, 2018

OK, I’ll release the new version in the next days then. I don’t see the need for extra pre-java9/post-java9 versions at the moment, So I’ll risk releasing just one version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

maven-jaxb2-plugin reports prefix is already bound, only in ...
I'm trying to debug a Maven-based Spring Boot project. It makes SOAP calls, and it uses the maven-jaxb2-plugin artifact in group org.jvnet.jaxb2 ...
Read more >
Mavenjaxb2Plugin Reports Prefix Is Already Bound Only In ...
Code generation fails with Prefix '' is already bound to '' when episode generation is on on Java 9 #146. Closed. highsource opened...
Read more >
Problems with java code generation - Sparx Systems
When I want to generate java code from data class diagram then some but not all the variable have a prefix "m_"
Read more >
Bug listing with status RESOLVED with resolution TEST ...
Bug:233 - "Emacs segfaults when merged through the sandbox." status:RESOLVED resolution:TEST-REQUEST severity:critical · Bug:3888 - "yenta_socket module not ...
Read more >
please remove 'm' prefix rule for member variable names from ...
This rule is being forced down the throats of developers in companies who are ... "Interesting.. the Google Java Code Style actually contradicts...
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