title: embed Javax to Java 9
body: <p>im trying to fix this for hours, I need help:</p>
  
  <p>Its the not unknown problem, that javax is not part of java 9, I cant figure out how to get it run without the following exeption:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 0 and column 0 in FILE C:\Users\Miles\Workspace\Projekte\SpringProjekte\RestForFun\resources\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.loadConfigXmlFile(ConfigLoader.java:76)
  at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:167)
  at org.hibernate.cfg.Configuration.configure(Configuration.java:300)
  at noobz.teamz.RestForFun.RestForFunApplication.main(RestForFunApplication.java:31)
  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)
  ... 5 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)
  ... 9 more
  </code></pre>
  
  <p>this is my example:</p>
  
  <pre><code>import org.hibernate.cfg.Configuration;
  import java.io.*;
  
  
  public class RestForFunApplication {
  
  
      public static void main(String[] args) {
  
  
          RestForFunApplication rsf = new RestForFunApplication();
  
          File file = new File("resources\\hibernate.cfg.xml");
          if (!file.exists())
              System.out.println("no hibernate.cfg.xml");
          Configuration sessionFactory = new Configuration();
          sessionFactory.configure(file);
      }
  }
  </code></pre>
  
  <p>This is my pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;noobz.teamz&lt;/groupId&gt;
  &lt;artifactId&gt;RestForFun&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;RestForFun&lt;/name&gt;
  &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.5.9.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;version&gt;42.1.4&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;5.2.12.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;version&gt;6.0.7.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-search&lt;/artifactId&gt;
          &lt;version&gt;5.8.2.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.inject&lt;/groupId&gt;
          &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
          &lt;version&gt;1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.xml.bind&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-api&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jaxb&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-core&lt;/artifactId&gt;
          &lt;version&gt;2.3.0&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.6.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;release&gt;9&lt;/release&gt;
                  &lt;compilerArgs&gt;
                      &lt;arg&gt;--add-modules&lt;/arg&gt;
                      &lt;arg&gt;javax.xml.bind&lt;/arg&gt;
                  &lt;/compilerArgs&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>this is my hibernate.cfg.xml</p>
  
  <pre><code>&lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;org.postgresql.Driver&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;db&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;usr&lt;/property&gt;
      &lt;property name="hibernate.connection.password"&gt;psswrd&lt;/property&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQL94Dialect&lt;/property&gt;
      &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  &lt;/session-factory&gt;
  </code></pre>
  
  <p></p>
  
  <p>I added </p>
  
  <pre><code>--add-modules=java.xml.bind,java.activation
  </code></pre>
  
  <p>and </p>
  
  <pre><code>--add-modules java.se.ee
  </code></pre>
  
  <p>to intellij idea compiler-settings and also tried to run via console with this.</p>
  
  <p>Nothing works, I still get the exception. Im allmost crying, is extremly nessecary to get this work.</p>