Ошибка при запуске сессии Hibernate ExceptionInInitializerError

395
11 марта 2018, 22:51

Возникает ошибка Exception in thread "main" java.lang.ExceptionInInitializerError at bl.HibernateUtil.buildSessionFactory

Не понимаю в чем проблема?

Вот проект https://github.com/Kaizersx/Hibernate-XML-mapping.git

Ошибка возникает во время компиляции:

Exception in thread "main" java.lang.ExceptionInInitializerError
at bl.HibernateUtil.buildSessionFactory(HibernateUtil.java:23)
at bl.HibernateUtil.<clinit>(HibernateUtil.java:16)
at domain.Domain.main(Domain.java:23)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43)
    at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:87)
    at org.hibernate.cfg.Configuration.<init>(Configuration.java:123)
    at org.hibernate.cfg.Configuration.<init>(Configuration.java:118)
    at bl.HibernateUtil.buildSessionFactory(HibernateUtil.java:20)
    ... 2 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 7 more

Теперь немного другой код.

  мар. 10, 2018 6:28:46 ПП org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.6.Final}
мар. 10, 2018 6:28:46 ПП org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
мар. 10, 2018 6:28:46 ПП org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.
Exception in thread "main" java.lang.ExceptionInInitializerError
    at bl.HibernateUtil.buildSessionFactory(HibernateUtil.java:23)
    at bl.HibernateUtil.<clinit>(HibernateUtil.java:16)
    at domain.Domain.main(Domain.java:23)
Caused by: org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 0 and column 0 in RESOURCE hibernate.cfg.xml. Message: null
    at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:133)
    at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:65)
    at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:57)
    at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:258)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:244)
    at bl.HibernateUtil.buildSessionFactory(HibernateUtil.java:20)
    ... 2 more
Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
    at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:122)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
    at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
    ... 12 more
READ ALSO
Как поменять Pane в javafx?

Как поменять Pane в javafx?

Мой main класс:

243
Android 7.1.2 AsyncTask в свернутом приложении

Android 7.1.2 AsyncTask в свернутом приложении

Я создаю приложение и конекчу его с сервером через AsyncTask каждый определенный отрезок времени с помощью AlarmManager и проблема в том что на android...

183
Java class delimiter

Java class delimiter

Всем приветЯ относительно недавно начал изучать Java

204
Разработка android приложения на диплом [требует правки]

Разработка android приложения на диплом [требует правки]

Взял себе тему " тайм-менеджмент "

193