Skip to content

Instantly share code, notes, and snippets.

@nipafx
Last active June 8, 2020 14:42
Show Gist options
  • Save nipafx/891f7307424df5b4ec13642e7560ad06 to your computer and use it in GitHub Desktop.
Save nipafx/891f7307424df5b4ec13642e7560ad06 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="statistics-unit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:h2:mem:test;INIT=CREATE SCHEMA IF NOT EXISTS test\;RUNSCRIPT FROM 'classpath:META-INF/init.sql'" />
<property name="javax.persistence.jdbc.user" value="sa" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="hibernate.archive.autodetection" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</properties>
</persistence-unit>
</persistence>
Exception in thread "main" 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.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:146)
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.<init>(EntityManagerFactoryBuilderImpl.java:228)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:170)
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:76)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:181)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:129)
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:71)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:52)
at hibernate.jpa/javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at hibernate.jpa/javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at monitor.persistence/monitor.persistence.StatisticsRepository.initialize(StatisticsRepository.java:25)
at monitor/monitor.Main.createMonitor(Main.java:43)
at monitor/monitor.Main.main(Main.java:22)
@mg2995
Copy link

mg2995 commented Jun 8, 2020

Facing the same issue. Any work around?

@nipafx
Copy link
Author

nipafx commented Jun 8, 2020

This from three years ago, so I don't know whether I ever fixed it. If you haven't tried that yet, make sure to run on Java 11 with all dependencies up to date. If the problem persists (har har), open a question on StackOverflow. You can leave the link here and I may take a look if I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment