SpringBoot App with Eclipse Link 3. Update version Error – ClassNotFoundException: jakarta.persistence.spi.PersistenceProvider

huangapple go评论77阅读模式
英文:

SpringBoot App with Eclipse Link 3. Update version Error - ClassNotFoundException: jakarta.persistence.spi.PersistenceProvider

问题

在升级SpringBoot应用至2.5.9和eclipseLink至3.0.0后,我遇到了以下错误:

Caused by: org.springframework.beans.BeanInstantiationException: 实例化 [org.springframework.orm.jpa.JpaVendorAdapter] 失败:工厂方法 'jpaVendorAdapter' 抛出异常;嵌套异常是 java.lang.NoClassDefFoundError: jakarta/persistence/spi/PersistenceProvider
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	... 62 common frames omitted
Caused by: java.lang.NoClassDefFoundError: jakarta/persistence/spi/PersistenceProvider
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2472)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:875)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1376)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
	at org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter.<init>(EclipseLinkJpaVendorAdapter.java:52)
	at com.config.EclipseLinkJpaConfiguration.createJpaVendorAdapter(EclipseLinkJpaConfiguration.java:38)
	at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.jpaVendorAdapter(JpaBaseConfiguration.java:105)
	at com.config.EclipseLinkJpaConfiguration$$EnhancerBySpringCGLIB$$5f9eca68.CGLIB$jpaVendorAdapter$8(<generated>)
	at com.config.EclipseLinkJpaConfiguration$$EnhancerBySpringCGLIB$$5f9eca68$$FastClassBySpringCGLIB$$54dd22bf.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
	at com.config.EclipseLinkJpaConfiguration$$EnhancerBySpringCGLIB$$5f9eca68.jpaVendorAdapter(<generated>)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 63 common frames omitted
Caused by: java.lang.ClassNotFoundException: jakarta.persistence.spi.PersistenceProvider
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
	... 83 common frames omitted
英文:

After update SpringBoot App 2.5.9 and eclipseLink from 2.7.12 to 3.0.0 I got this error:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method &#39;jpaVendorAdapter&#39; threw exception; nested exception is java.lang.NoClassDefFoundError: jakarta/persistence/spi/PersistenceProvider
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	... 62 common frames omitted
Caused by: java.lang.NoClassDefFoundError: jakarta/persistence/spi/PersistenceProvider
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2472)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:875)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1376)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
	at org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter.&lt;init&gt;(EclipseLinkJpaVendorAdapter.java:52)
	at com.config.EclipseLinkJpaConfiguration.createJpaVendorAdapter(EclipseLinkJpaConfiguration.java:38)
	at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.jpaVendorAdapter(JpaBaseConfiguration.java:105)
	at com.config.EclipseLinkJpaConfiguration$$EnhancerBySpringCGLIB$$5f9eca68.CGLIB$jpaVendorAdapter$8(&lt;generated&gt;)
	at com.config.EclipseLinkJpaConfiguration$$EnhancerBySpringCGLIB$$5f9eca68$$FastClassBySpringCGLIB$$54dd22bf.invoke(&lt;generated&gt;)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
	at com.config.EclipseLinkJpaConfiguration$$EnhancerBySpringCGLIB$$5f9eca68.jpaVendorAdapter(&lt;generated&gt;)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	... 63 common frames omitted
Caused by: java.lang.ClassNotFoundException: jakarta.persistence.spi.PersistenceProvider
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
	... 83 common frames omitted

答案1

得分: 2

Upgrading to EclipseLink 3 requires an upgrade to SpringBoot 3x and Java17.

EclipseLink 3 uses Jakarta Persistence 3

SpringBoot 3 is required for Jakarta Persistence 3

Springboot 3 requires Java 17

英文:

Upgrading to EclipseLink 3 requires an upgrade to SpringBoot 3x and Java17.

EclipseLink 3 uses Jakarta Persistence 3

SpringBoot 3 is required for Jakarta Persistence 3

Springboot 3 requires Java 17

huangapple
  • 本文由 发表于 2023年5月22日 23:22:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76307684.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定