title: Hibernate error: Invocation of init method failed; nested exception is org.hibernate.boot.archive.spi.ArchiveException: Could not build ClassFile
body: <p>I'm trying to deploy a backend app with a REST API that I have created. Program runs perfectly fine when I'm running from my console however when I try to create a jar file and execute it. I am running into a lot of errors when I'm trying to run a jar file that I have created from my maven project, however I can't execute the jar file due to this Hibernate error. I've tried adding dependencies to my pom.xml file but nothing seems to be working.</p>
  
  <p>I removed duplicated files in the Hibernate-core folder and some errors have been fixed but I still get an archive exception error.
  error message</p>
  
  <pre><code>    log4j: Adding appender named [consoleAppender] to category [root].
      18 Jul 2019 12:05:21  INFO Version - HV000001: Hibernate Validator 6.0.17.Final
  
        .   ____          _            __ _ _
       /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
      ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
       \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
        '  |____| .__|_| |_|_| |_\__, | / / / /
       =========|_|==============|___/=/_/_/_/
       :: Spring Boot ::        (v2.1.6.RELEASE)
  
      18 Jul 2019 12:05:22  INFO MainRun - Starting MainRun v4.0.0 on LAPTOP-SBPKOCKV with PID 2744 (C:\Internship2019\examples-master\ctakes-web-client\target\ctakes-web-client.jar started by user in C:\Internship2019\examples-master\ctakes-web-client\target)
      18 Jul 2019 12:05:22  INFO MainRun - No active profile set, falling back to default profiles: default
      18 Jul 2019 12:05:23  INFO TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
      Jul 18, 2019 12:05:23 PM org.apache.catalina.core.StandardService startInternal
      INFO: Starting service [Tomcat]
      Jul 18, 2019 12:05:23 PM org.apache.catalina.core.StandardEngine startInternal
      INFO: Starting Servlet engine: [Apache Tomcat/9.0.21]
      Jul 18, 2019 12:05:24 PM org.apache.catalina.core.ApplicationContext log
      INFO: Initializing Spring embedded WebApplicationContext
      18 Jul 2019 12:05:24  INFO ContextLoader - Root WebApplicationContext: initialization completed in 1781 ms
      18 Jul 2019 12:05:24  INFO EmbeddedDatabaseFactory - Starting embedded database: url='jdbc:hsqldb:mem:testdb', username='sa'
      18 Jul 2019 12:05:24  INFO LogHelper - HHH000204: Processing PersistenceUnitInfo [
              name: default
              ...]
      18 Jul 2019 12:05:24  INFO Version - HHH000412: Hibernate Core {5.3.10.Final}
      18 Jul 2019 12:05:24  INFO Environment - HHH000206: hibernate.properties not found
      18 Jul 2019 12:05:24  INFO Version - HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
      18 Jul 2019 12:05:24  WARN AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.boot.archive.spi.ArchiveException: Could not build ClassFile
      18 Jul 2019 12:05:24  INFO EmbeddedDatabaseFactory - Shutting down embedded database: url='jdbc:hsqldb:mem:testdb'
      Jul 18, 2019 12:05:24 PM org.apache.catalina.core.StandardService stopInternal
      INFO: Stopping service [Tomcat]
      18 Jul 2019 12:05:24  INFO ConditionEvaluationReportLoggingListener -
  
      Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
      18 Jul 2019 12:05:24 ERROR SpringApplication - Application run failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.boot.archive.spi.ArchiveException: Could not build ClassFile
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
  </code></pre>
  
  <pre><code>&lt;repository&gt;
      &lt;id&gt;apache.snapshots&lt;/id&gt;
      &lt;name&gt;Apache Development Snapshot Repository&lt;/name&gt;
      &lt;url&gt;https://repository.apache.org/content/repositories/snapshots/&lt;/url&gt;
      &lt;releases&gt;
          &lt;enabled&gt;false&lt;/enabled&gt;
      &lt;/releases&gt;
      &lt;snapshots&gt;
          &lt;enabled&gt;true&lt;/enabled&gt;
      &lt;/snapshots&gt;
  &lt;/repository&gt;
  &lt;/repositories&gt;
  
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
              &lt;artifactId&gt;jetty-server&lt;/artifactId&gt;
              &lt;version&gt;9.2.10.v20150310&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-autoconfigure&lt;/artifactId&gt;
              &lt;version&gt;2.1.6.RELEASE&lt;/version&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;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.jayway.jsonpath&lt;/groupId&gt;
              &lt;artifactId&gt;json-path&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&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;/dependencies&gt;
      &lt;build&gt;
          &lt;finalName&gt;ctakes-web-client&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;compilerArgument&gt;-Xlint&lt;/compilerArgument&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;!-- Build an executable JAR --&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                              &lt;mainClass&gt;org.apache.ctakes.web.client.servlet.MainRun&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&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;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>
  
  <pre><code>
  </code></pre>