# javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.hibernate.org/xsd/orm/hbm")

**URL:** <https://discourse.hibernate.org/t/javax-xml-bind-unmarshalexception-unexpected-element-uri-http-www-hibernate-org-xsd-orm-hbm/5704>\
**Category:** Hibernate ORM\
**Created:** [September 14, 2021, 5:38pm UTC](https://discourse.hibernate.org/t/javax-xml-bind-unmarshalexception-unexpected-element-uri-http-www-hibernate-org-xsd-orm-hbm/5704 "2021-09-14T17:38:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhau](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@bhau](https://discourse.hibernate.org/u/bhau)\
**Post date:** [September 14, 2021, 5:38pm UTC](https://discourse.hibernate.org/t/javax-xml-bind-unmarshalexception-unexpected-element-uri-http-www-hibernate-org-xsd-orm-hbm/5704/1 "2021-09-14T17:38:43Z")

</div>

Hi,

We are getting unmarshalException after upgarding from hibernate-5.4.4 to 5.4.24 while loading third party jars . During debugging we noticed that none of hbm.xml files included in third party jars are getting loaded and getting unmarshalException.

Here is the snapshot of exception:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.boot.InvalidMappingException: Could not parse mapping document: null (INPUT\_STREAM)  
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794)  
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)  
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)  
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)  
at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$1144/0x00000000d3dc3fe0.getObject(Unknown Source)  
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)  
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)  
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)  
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)  
… 209 more  
Caused by: org.hibernate.boot.InvalidMappingException: Could not parse mapping document: null (INPUT\_STREAM)  
at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:46)  
at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:38)  
at org.hibernate.boot.spi.XmlMappingBinderAccess.bind(XmlMappingBinderAccess.java:94)  
at org.hibernate.boot.MetadataSources.addInputStream(MetadataSources.java:381)  
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:475)  
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:509)  
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)  
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)  
… 217 more  
Caused by: org.hibernate.boot.MappingException: Unable to perform unmarshalling at line number -1 and column -1. Message: unexpected element (uri:“[Index of /xsd/orm/hbm - Hibernate](http://www.hibernate.org/xsd/orm/hbm)”, local:“hibernate-mapping”). Expected elements are \<{}hibernate-mapping\> : origin(null)  
at org.hibernate.boot.jaxb.internal.AbstractBinder.jaxb(AbstractBinder.java:177)  
at org.hibernate.boot.jaxb.internal.MappingBinder.doBind(MappingBinder.java:61)  
at org.hibernate.boot.jaxb.internal.AbstractBinder.doBind(AbstractBinder.java:102)  
at org.hibernate.boot.jaxb.internal.AbstractBinder.bind(AbstractBinder.java:57)  
at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:43)  
… 224 more  
Caused by: javax.xml.bind.UnmarshalException

- with linked exception:  
[javax.xml.bind.UnmarshalException: unexpected element (uri:“[Index of /xsd/orm/hbm - Hibernate](http://www.hibernate.org/xsd/orm/hbm)”, local:“hibernate-mapping”). Expected elements are \<{}hibernate-mapping\>]  
at com.ibm.jtc.jax.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:507)  
at com.ibm.jtc.jax.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:474)  
at com.ibm.jtc.jax.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:443)  
at com.ibm.xml.xlxp2.jaxb.unmarshal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:295)  
at org.hibernate.boot.jaxb.internal.AbstractBinder.jaxb(AbstractBinder.java:171)  
… 228 more

Please advise.

Thanks,  
Bhau

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [September 15, 2021, 6:25am UTC](https://discourse.hibernate.org/t/javax-xml-bind-unmarshalexception-unexpected-element-uri-http-www-hibernate-org-xsd-orm-hbm/5704/2 "2021-09-15T06:25:27Z")

</div>

Can you post an excerpt of these hbm.xml files here so we can understand why it fails to parse them?
