JPA eclipselink 3.0 implementation not working with java 11 and giving java.lang.IncompatibleClassChangeError

124 Views Asked by At

I am using java and eclipselink implemetation of JPA in my project, I need to upgrade my app from java 8 to java 11, so based on recommendation of official website eclipselink, upgraded eclipselink to 3.0 https://eclipse.dev/eclipselink/releases/3.0.php for java 11 but after upgrading the elcipselink version I started seeing below error,

[ERROR ][main] 
Context initialization failed org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'defaultEntityManagerFactory' defined in ServletContext resource 
[/META-INF/applicationContext.xml]: 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
: Exception encountered during context initialization - cancelling refresh attempt: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEntityManagerFactory' 
defined in ServletContext resource [/META-INF/applicationContext.xml]: Invocation of init method failed;
nested exception is java.lang.IncompatibleClassChangeError: Class org.eclipse.persistence.jpa.PersistenceProvider does not implement the requested interface javax.persistence.spi.PersistenceProvider 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786)|   at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)|      at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)|        at
 org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)|      at
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)|  at
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)|       at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)| at 
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)|        at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)| at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)| at 
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)|      at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)|     at 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)|    at
 org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4494)|   at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4946)|   at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)|        at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1328)|     at
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1318)|     at 
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)|  at 
org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)| at 
java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)|     at 
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)|        at
 org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:795)|  at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)|        at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1328)|     at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1318)|     at 
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)|  at 
org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)| at 
java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)|     at 
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)|        at 
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:249)|      at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)|        at 
org.apache.catalina.core.StandardService.startInternal(StandardService.java:428)|    at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)|        at 
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:923)|      at
 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)|        at 
org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)|   at 

This is working properly with java8 * eclipselink 2.5.2 combination, but I need to upgrade my java to 11 hence need to upgrade eclipselink to 3(old eclipselink version is not supported on java 11) but facing this issue. please help. thanks in advance for help.

0

There are 0 best solutions below