I'm having the following exception while running Kundera inside a java 8 class.
java.io.IOException: invalid constant type: 18 at javassist.bytecode.ConstPool.readOne(ConstPool.java:1090) at javassist.bytecode.ConstPool.read(ConstPool.java:1033) at javassist.bytecode.ConstPool.<init>(ConstPool.java:149) at javassist.bytecode.ClassFile.read(ClassFile.java:737) at javassist.bytecode.ClassFile.<init>(ClassFile.java:108) at com.impetus.kundera.configure.MetamodelConfiguration.scanClassAndPutMetadata(MetamodelConfiguration.java:315) at com.impetus.kundera.configure.MetamodelConfiguration.loadEntityMetadata(MetamodelConfiguration.java:231) at com.impetus.kundera.configure.MetamodelConfiguration.configure(MetamodelConfiguration.java:112) at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configure(EntityManagerFactoryImpl.java:158) at com.impetus.kundera.persistence.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:135) at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:85) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
The problem is due the fact that Kundera refers to an old version of javassist (3.12.1.GA) that it's not compliant to java 8 bytecode. From the version 3.18.0 this issue has been resolved.
The code I'm using is pretty simple: there are 2 entities with some properties(TaskInstance and JobInstance) and a test class.
I'm writing a simple test that inserts one row of TaskInstance and 10 rows of JobInstance. I'm using cassandra as storage.
If I run the following code it breaks with the above exception, while replacing the java 8 specific part with the for loop the code completes without errors.
@Test
public void createTaskAndJobs() {
TaskInstance task = newTaskInstance(), result;
TaskInstanceId id = task.getTaskId();
em.persist(task);
result = em.find(TaskInstance.class, new TaskInstanceId(id.getTenant(), id.getRequester(), id.getInsertTs(), id.getTaskId()));
Assert.assertEquals(Status.NEW, result.getStatus());
/*
for(int i = 0; i < 10; i++) {
JobInstance job = newJobInstance(id.getTaskId(), new Random().nextInt(100));
em.persist(job);
}
*/
IntStream.range(0, 10)
.mapToObj(i -> newJobInstance(id.getTaskId(), new Random().nextInt(100)))
.forEach(job -> em.persist(job));
task.setStatus(Status.RUNNING);
em.merge(task);
em = emf.createEntityManager();
result = em.find(TaskInstance.class, new TaskInstanceId(id.getTenant(), id.getRequester(), id.getInsertTs(), id.getTaskId()));
Assert.assertEquals(task.getTaskId().getTaskId(), result.getTaskId().getTaskId());
Assert.assertEquals(Status.RUNNING, result.getStatus());
Assert.assertEquals(new Integer(11), result.getTotalJobs());
em.close();
emf.close();
}
At the moment this pom dependency configuration fixes the issue, but I think it should be fixed on Kundera's dependency tree
Hi,
I'm having the following exception while running Kundera inside a java 8 class.
java.io.IOException: invalid constant type: 18 at javassist.bytecode.ConstPool.readOne(ConstPool.java:1090) at javassist.bytecode.ConstPool.read(ConstPool.java:1033) at javassist.bytecode.ConstPool.<init>(ConstPool.java:149) at javassist.bytecode.ClassFile.read(ClassFile.java:737) at javassist.bytecode.ClassFile.<init>(ClassFile.java:108) at com.impetus.kundera.configure.MetamodelConfiguration.scanClassAndPutMetadata(MetamodelConfiguration.java:315) at com.impetus.kundera.configure.MetamodelConfiguration.loadEntityMetadata(MetamodelConfiguration.java:231) at com.impetus.kundera.configure.MetamodelConfiguration.configure(MetamodelConfiguration.java:112) at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configure(EntityManagerFactoryImpl.java:158) at com.impetus.kundera.persistence.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:135) at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:85) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
The problem is due the fact that Kundera refers to an old version of javassist (3.12.1.GA) that it's not compliant to java 8 bytecode. From the version 3.18.0 this issue has been resolved.
The code I'm using is pretty simple: there are 2 entities with some properties(TaskInstance and JobInstance) and a test class. I'm writing a simple test that inserts one row of TaskInstance and 10 rows of JobInstance. I'm using cassandra as storage. If I run the following code it breaks with the above exception, while replacing the java 8 specific part with the for loop the code completes without errors.
At the moment this pom dependency configuration fixes the issue, but I think it should be fixed on Kundera's dependency tree
Thank you Andrea