英文:
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 'jpaVendorAdapter' 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.<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
答案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
英文:
Upgrading to EclipseLink 3 requires an upgrade to SpringBoot 3x and Java17.
EclipseLink 3 uses Jakarta Persistence 3
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论