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.

Support schema bindings on Java 9

See original GitHub issue

When running on Java 9, schema bindings are apparently not applied - instead the XSD’s namespace is used to determine the package.

Description

It makes no difference whether this block is present in the XSD…

<xsd:annotation>
	<xsd:appinfo>
		<jaxb:schemaBindings>
			<jaxb:package name="com.pany.pack.age" />
		</jaxb:schemaBindings>
	</xsd:appinfo>
</xsd:annotation>

… or this block in a bindings.xjb

<jaxb:bindings schemaLocation="that/other/schema.xsd" node="/xsd:schema">
	<jaxb:schemaBindings>
		<jaxb:package name="com.pany.pack.age" />
	</jaxb:schemaBindings>
</jaxb:bindings>

… in both cases, the binding is ignored.

Experiments

I observed that the xjc command line tool in Java 8 and 9 exhibits the expected behavior and that the difference between the Maven run on Java 8 and 9 was that the former uses rt.jar as JAXB API, while the latter uses the plugin’s dependency javax.xml.bind:jaxb-api.

It took me a while but eventually I got the Java 9 Maven build to say Java JAXB API is loaded from the [jrt:/java.xml.bind], i.e. it used the Java 9 module java.xml.bind but that still didn’t do the job.

Sources

Maybe one of these can help (I’m shooting in the dark here, could be utterly irrelevant):

  • JEP 255 (merges Selected Xerces 2.11.0 Updates into JAXP)
  • JEP 268 (develops a standard XML Catalog API that supports the OASIS XML Catalogs standard, v1.1)
  • Apache Camel had another issue and “resolved” it by using org.apache.cxf:cxf-xjc-plugin instead - maybe they’re doing something differently?

Related to #114.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:83 (46 by maintainers)

github_iconTop GitHub Comments

9reactions
highsourcecommented, Feb 19, 2018

In principle, yes, I consider adding Java 9 support.

3reactions
nipafxcommented, Feb 18, 2018

That problem has something to do with episode files. I have no clue what those are and what they’re used to, but the solution is to put <epsiode>false</episode> into the plugin configuration. (Sorry for not being more precise, I don’t have it in front of me right now.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 17 Binding between XML Schema and Java Classes
The JavaTM Architecture for XML Binding (JAXB) provides a fast and convenient way to bind between XML schemas and Java representations, making it...
Read more >
JAXB on Java 9, 10, 11 and beyond - Jesper de Jong
The JAXB-specific xjc and schemagen tools, which you use to convert an XML Schema (*.xsd file) to a set of Java classes and...
Read more >
Using XML Bindings | EclipseLink 2.4.x EclipseLink MOXy
An XML Bindings document is XML that specifies Java type information, mapping information, context-wide properties – everything you need to ...
Read more >
JAXB - IBM
JAXB is an XML to Java binding technology that supports transformation between schema and Java objects and between XML instance documents and Java...
Read more >
The Java™ Architecture for XML Binding User's Guide
parsers and processors do not support schemas or do not require schemas. ... Introduction to the JavaTM Architecture for XML Binding (JAXB). 9....
Read more >

github_iconTop Related Medium Post

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