title: Implementation of JAXB-API has not been found(when running java jar)
body: <p>I am getting error in the line (JAXBContext.newInstance):</p>
  
  <pre><code>    @Override
      public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
      SoapHeader soapHeader = ((SoapMessage)message).getSoapHeader();
  
      try {
          JAXBContext context = JAXBContext.newInstance(AuthHeader.class);
          Marshaller marshaller = context.createMarshaller();
          marshaller.marshal(authentication, soapHeader.getResult());
  
      } catch (JAXBException e) {
          System.out.println(e.getMessage());
          throw new IOException("error while marshalling authentication.");
      }
  }
  </code></pre>
  
  <p>While it runs fine when this is executed as test case using:</p>
  
  <pre><code> mvn install
  </code></pre>
  
  <p>or
      mvn:spring:boot run</p>
  
  <p>But causes issue when the jar is run using:</p>
  
  <pre><code>java -jar target/fileName-0.0.1-SNAPSHOT.jar 
  </code></pre>
  
  <p>Error when running java -jar and hit using postman.</p>
  
  <pre><code>Implementation of JAXB-API has not been found on module path or classpath.
  
  java.io.IOException: error while marshalling authentication.
  </code></pre>
  
  <p>Version info </p>
  
  <pre><code>mvn -version
  Apache Maven 3.6.0
  Maven home: /usr/share/maven
  Java version: 11.0.7, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
  Default locale: en, platform encoding: UTF-8
  OS name: "linux", version: "4.15.0-1051-aws", arch: "amd64", family: "unix"
  
  java -version
  openjdk version "11.0.7" 2020-04-14
  OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
  OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)
  </code></pre>
  
  <p>Same jar runs fine on development server but doesn't run on staging server. Both development and staging server have same environment (java version, mvn, everything is same). I have these dependencies added to pom.xml:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
          &lt;version&gt;2.3.3&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>If it's related to fat jar then why other dependencies like amazon s3, stripe etc. works with normal jar. What's the issue with jaxb only ?</p>
  
  <p>I even tried to create fat jar using mvn package with the following config:</p>
  
  <pre><code>    &lt;plugin&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;executions&gt;
              &lt;execution&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;repackage&lt;/goal&gt;
                  &lt;/goals&gt;
                  &lt;configuration&gt;
                      &lt;mainClass&gt;com.patracorp.patrapay.PatrapayApplication&lt;/mainClass&gt;
                      &lt;layout&gt;ZIP&lt;/layout&gt;
                  &lt;/configuration&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>but still getting the same error. </p>