hibernate-demos icon indicating copy to clipboard operation
hibernate-demos copied to clipboard

Demo jpa-cdi-testing does not work on java 14

Open Bukama opened this issue 5 years ago • 2 comments

As I'm trying to setup our projects to make JPA tests possible without using Arquillian (which is a pain due long deployment times on WAS 9) I found @gunnarmorling demo jpa-cdi-testing project which seems to do exactly this.

So I just cloned it, importet it into IntelliJ and executed the tests. But both fail with this error message:

2020-03-21 20:34:50 INFO  Version:148 - WELD-000900: 3.0.5 (Final)

org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Built-in Bean [javax.transaction.UserTransaction] with qualifiers [@Default] with class interface javax.transaction.UserTransaction using classloader jdk.internal.loader.ClassLoaders$AppClassLoader@2626b418

	at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:370)
	at org.jboss.weld.bean.proxy.ProxyFactory.run(ProxyFactory.java:324)
	at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:316)
	at org.jboss.weld.bean.builtin.ee.AbstractEEBean.<init>(AbstractEEBean.java:36)
	at org.jboss.weld.module.jta.UserTransactionBean.<init>(UserTransactionBean.java:52)
	at org.jboss.weld.module.jta.WeldTransactionsModule.preBeanRegistration(WeldTransactionsModule.java:46)
	at org.jboss.weld.module.WeldModules.preBeanRegistration(WeldModules.java:158)
	at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:224)
	at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:432)
	at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:86)
	at org.jboss.weld.environment.se.Weld.initialize(Weld.java:800)
	at org.jboss.weld.junit.AbstractWeldInitiator.initWeldContainer(AbstractWeldInitiator.java:495)
	at org.jboss.weld.junit4.WeldInitiator.access$300(WeldInitiator.java:90)
	at org.jboss.weld.junit4.WeldInitiator$1.evaluate(WeldInitiator.java:226)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.Error: java.lang.NoSuchFieldException: override
	at org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:394)
	at org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:385)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:551)
	at org.jboss.classfilewriter.ClassFile.<clinit>(ClassFile.java:385)
	at org.jboss.weld.bean.proxy.ProxyFactory.newClassFile(ProxyFactory.java:476)
	at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:436)
	at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:362)
	... 28 more
Caused by: java.lang.NoSuchFieldException: override
	at java.base/java.lang.Class.getDeclaredField(Class.java:2417)
	at org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:392)
	... 34 more


Process finished with exit code -1

Would really see this demo working again so I can try to adopt things of it for our scenario.

Bukama avatar Mar 21 '20 19:03 Bukama

That's a compatibility issue with Java versions, see https://github.com/jbossas/jboss-classfilewriter/issues/18. This was implemented based on JDK 8 back then, dependencies would need updating for newer JDKs. Perhaps you could send a PR for doing so?

gunnarmorling avatar Mar 21 '20 19:03 gunnarmorling

Ah thanks! After switching to JDK 8 the demo project works fine. Will have a look if I can manage to update the dependencies. Could take some time as I'm still struggeling (understanding) with all this WELD stuff. But I'll keep in mind!

Bukama avatar Mar 22 '20 09:03 Bukama