We're updating the issue view to help you get more done. 

JAXB exception using SchemaExport with Envers and Java 9+

Description

When using org.hibernate.tool.hbm2ddl.SchemaExport programmatically, if there are Envers entities involved the DDL generation fails with this exception:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.hibernate.org/xsd/orm/hbm", local:"hibernate-mapping"). Expected elements are <{}hibernate-mapping> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent (UnmarshallingContext.java:744) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError (Loader.java:262) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError (Loader.java:257) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement (Loader.java:124) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement (UnmarshallingContext.java:1149) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement (UnmarshallingContext.java:574) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement (UnmarshallingContext.java:556) at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement (InterningXmlVisitor.java:75) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXEventConnector.handleStartElement (StAXEventConnector.java:261) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge (StAXEventConnector.java:130) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0 (UnmarshallerImpl.java:460) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal (UnmarshallerImpl.java:435) at org.hibernate.boot.jaxb.internal.AbstractBinder.jaxb (AbstractBinder.java:181) at org.hibernate.boot.jaxb.internal.MappingBinder.doBind (MappingBinder.java:62) at org.hibernate.boot.jaxb.internal.AbstractBinder$1.run (AbstractBinder.java:108) at org.hibernate.boot.jaxb.internal.AbstractBinder$1.run (AbstractBinder.java:104) at org.hibernate.boot.jaxb.internal.AbstractBinder.doBind (AbstractBinder.java:112) at org.hibernate.boot.jaxb.internal.AbstractBinder.bind (AbstractBinder.java:60) at org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl$1.addDocument (AdditionalJaxbMappingProducerImpl.java:94) at org.hibernate.envers.configuration.internal.EntitiesConfigurator.configure (EntitiesConfigurator.java:111) at org.hibernate.envers.boot.internal.EnversServiceImpl.doInitialize (EnversServiceImpl.java:154) at org.hibernate.envers.boot.internal.EnversServiceImpl.initialize (EnversServiceImpl.java:118) at org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl.produceAdditionalMappings (AdditionalJaxbMappingProducerImpl.java:101) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete (MetadataBuildingProcess.java:297) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build (MetadataBuildingProcess.java:84) at org.hibernate.boot.internal.MetadataBuilderImpl.build (MetadataBuilderImpl.java:474) at org.hibernate.boot.internal.MetadataBuilderImpl.build (MetadataBuilderImpl.java:85) at org.hibernate.boot.MetadataSources.buildMetadata (MetadataSources.java:180)

The same DDL is exported without any exception with Java 8.

Sample test case: https://github.com/heruan/hibernate-ddl-generator

Environment

Java 9 or Java 10

Status

Assignee

Chris Cranford

Reporter

Giovanni Lovato

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.3.3

Priority

Major