title: ArchiveException: Could not build ClassFile
body: <p>I got stuck with a problem with an EAR deployment on JBOSS 10.1.2</p>
  
  <p>I get the foolowing exception:</p>
  
  <pre><code>Caused by: org.hibernate.boot.archive.spi.ArchiveException: Could not build ClassFile
      at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassFile(ClassFileArchiveEntryHandler.java:64)
      at org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:47)
      at org.jboss.as.jpa.hibernate5.VirtualFileSystemArchiveDescriptor.processVirtualFile(VirtualFileSystemArchiveDescriptor.java:94)
      at org.jboss.as.jpa.hibernate5.VirtualFileSystemArchiveDescriptor.processVirtualFile(VirtualFileSystemArchiveDescriptor.java:69)
      at org.jboss.as.jpa.hibernate5.VirtualFileSystemArchiveDescriptor.processVirtualFile(VirtualFileSystemArchiveDescriptor.java:69)
      at org.jboss.as.jpa.hibernate5.VirtualFileSystemArchiveDescriptor.visitArchive(VirtualFileSystemArchiveDescriptor.java:49)
      at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:47)
      at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:75)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:98)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.&lt;init&gt;(EntityManagerFactoryBuilderImpl.java:199)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.&lt;init&gt;(EntityManagerFactoryBuilderImpl.java:149)
      at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:28)
      at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:40)
      at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.&lt;init&gt;(TwoPhaseBootstrapImpl.java:39)
      at org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.getBootstrap(HibernatePersistenceProviderAdaptor.java:159)
      at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.createContainerEntityManagerFactoryBuilder(PhaseOnePersistenceUnitServiceImpl.java:242)
      at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access$800(PhaseOnePersistenceUnitServiceImpl.java:59)
      at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:117)
      ... 7 more
  </code></pre>
  
  <p>I looked on the internet and found out, that this exception comes because of different <strong>javassist version</strong>.</p>
  
  <p>The answers in <a href="https://stackoverflow.com/questions/27202939/could-not-build-classfile-archiveexception">this post on stackoverflow</a> were not usefull, because I neither use Spring, nor Weblogic, nor Thymyleaf.</p>
  
  <p>There are two libraries which use javassist: <strong>Hibernate</strong> and <strong>org.reflections</strong>. Using Maven dependency tree I can find following out:</p>
  
  <p>for <strong>org.reflections</strong></p>
  
  <pre><code>[INFO] |  +- org.reflections:reflections:jar:0.9.11:compile
  [INFO] |  |  +- (com.google.guava:guava:jar:20.0:compile - omitted for conflict with 21.0)
  [INFO] |  |  \- (org.javassist:javassist:jar:3.21.0-GA:compile - omitted for conflict with 3.20.0-GA)
  </code></pre>
  
  <p>for <strong>Hibernate</strong>:</p>
  
  <pre><code>[INFO] |  |  +- org.hibernate:hibernate-core:jar:5.2.8.Final:provided
  [INFO] |  |  |  +- (org.jboss.logging:jboss-logging:jar:3.3.0.Final:provided - omitted for conflict with 3.1.4.GA)
  [INFO] |  |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:provided
  [INFO] |  |  |  +- org.javassist:javassist:jar:3.20.0-GA:provided
  </code></pre>
  
  <p>My <code>lib</code> folder of the EAR contains</p>
  
  <pre><code>hibernate-core-5.2.8.Final.jar
  javassist-3.20.0-GA.jar
  </code></pre>
  
  <p>JBOSS has also a module for javassists with </p>
  
  <pre><code>javassist-3.18.1.GA-redhat-2.jar
  </code></pre>
  
  <p>Now I am a little bit confused about the whole problem. I tried to remove references for <strong>org.reflections</strong>, but the deployment still failed.</p>
  
  <p>Has anyone an idea?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Ok, I found out which library causes exception:</p>
  
  <pre><code>&lt;dependency&gt;
     &lt;groupId&gt;com.google.template&lt;/groupId&gt;
     &lt;artifactId&gt;soy&lt;/artifactId&gt;
     &lt;version&gt;2018-01-03&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>But I stil don't know how to solve the problem.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Ok, I tried to use the previous maven version of the libarary (2017-08-08) and it works. Don't know what the issue can be. Should possibly report it to the library owner on Github. If anyone has an idea you are welcome.</p>