TongWeb java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider

最近国产化适配项目,一切按照部署文档进行相关部署,但是所用的容器为东方通,在进行项目国产化适配过程中,测试环境下,使用tomcat项目很正常的能运行,迁移到东方通的tongweb下,项目也正常启动起来了,但是在保存或者更新数据库数据时会报错,提示类找不到

[2021-08-04 09:55:01 281] [SEVERE] [http-nio2-8088-exec-17] [core] [Servlet.service() for servlet [dispatcher] in context with path [manager] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/spi/PersistenceProvider] with root cause]
java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at com.tongweb.server.TWServerURLClassLoader.loadClass0(TWServerURLClassLoader.java:46)
    at com.tongweb.server.TWServerURLClassLoader.access$000(TWServerURLClassLoader.java:11)
    at com.tongweb.server.TWServerURLClassLoader$1.loadClass(TWServerURLClassLoader.java:40)
    at com.tongweb.common.LoadClassCache.cacheLoadClass(LoadClassCache.java:63)
    at com.tongweb.server.TWServerURLClassLoader.loadClass(TWServerURLClassLoader.java:37)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at com.tongweb.server.TWServerURLClassLoader.loadClass0(TWServerURLClassLoader.java:46)
    at com.tongweb.server.TWServerURLClassLoader.access$000(TWServerURLClassLoader.java:11)
    at com.tongweb.server.TWServerURLClassLoader$1.loadClass(TWServerURLClassLoader.java:40)
    at com.tongweb.common.LoadClassCache.cacheLoadClass(LoadClassCache.java:63)
    at com.tongweb.server.TWServerURLClassLoader.loadClass(TWServerURLClassLoader.java:37)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
    at com.tongweb.server.TWServerURLClassLoader.loadClass0(TWServerURLClassLoader.java:46)
    at com.tongweb.server.TWServerURLClassLoader.access$000(TWServerURLClassLoader.java:11)
    at com.tongweb.server.TWServerURLClassLoader$1.loadClass(TWServerURLClassLoader.java:40)
    at com.tongweb.common.LoadClassCache.cacheLoadClass(LoadClassCache.java:63)
    at com.tongweb.server.TWServerURLClassLoader.loadClass(TWServerURLClassLoader.java:37)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.tongweb.tongejb.core.ConnectorClassLoader.loadClass(ConnectorClassLoader.java:133)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at com.tongweb.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1260)
    at com.tongweb.tomee.catalina.ThanosTomEEWebappClassLoader.access$101(ThanosTomEEWebappClassLoader.java:19)
    at com.tongweb.tomee.catalina.ThanosTomEEWebappClassLoader$1.loadClass(ThanosTomEEWebappClassLoader.java:90)
    at com.tongweb.common.LoadClassCache.cacheLoadClass(LoadClassCache.java:63)
    at com.tongweb.tomee.catalina.ThanosTomEEWebappClassLoader.loadClass(ThanosTomEEWebappClassLoader.java:76)
    at com.tongweb.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1143)
    at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.loadResolverClasses(PersistenceProviderResolverHolder.java:142)
    at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.<init>(PersistenceProviderResolverHolder.java:122)
    at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader.getPersistenceProviders(PersistenceProviderResolverHolder.java:80)
    at javax.persistence.Persistence.getProviders(Persistence.java:69)
    at javax.persistence.Persistence.access$000(Persistence.java:23)
    at javax.persistence.Persistence$1.isLoaded(Persistence.java:109)
    at org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:46)
    at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:128)
    at org.hibernate.validator.internal.engine.resolver.CachingTraversableResolverForSingleValidation.isReachable(CachingTraversableResolverForSingleValidation.java:36)
    at org.hibernate.validator.internal.engine.ValidatorImpl.isReachable(ValidatorImpl.java:1612)
    at org.hibernate.validator.internal.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1597)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:609)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:580)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java:524)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:492)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:457)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:407)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:205)
    at com.zfsoft.common.BeanValidationUtil.validateClass(BeanValidationUtil.java:175)
    at com.zfsoft.ahs.basic.controller.PeripheralInfoController.saveOrUpdatePeripheralInfo(PeripheralInfoController.java:145)
    at com.zfsoft.ahs.basic.controller.PeripheralInfoController$$FastClassBySpringCGLIB$$1068796b.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:711)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
    at com.zfsoft.base.annotion.TokenAop.doAround(TokenAop.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
    at com.zfsoft.base.aop.BussinessLogAop.doAround(BussinessLogAop.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
    at com.zfsoft.ahs.basic.controller.PeripheralInfoController$$EnhancerBySpringCGLIB$$e3303028.saveOrUpdatePeripheralInfo(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.tongweb.web.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:450)
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.zfsoft.filter.shiro.TerminalInfoFilter.doFilter(TerminalInfoFilter.java:37)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:152)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.zfsoft.filter.shiro.UrlParamFilter.doFilter(UrlParamFilter.java:169)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
    at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
    at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389)
    at com.tongweb.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at com.tongweb.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.tongweb.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at com.tongweb.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
    at com.tongweb.catalina.core.ThanosStandardContextValve.invoke(ThanosStandardContextValve.java:107)
    at com.tongweb.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
    at com.tongweb.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:452)
    at com.tongweb.catalina.core.StandardHostValve.invoke(StandardHostValve.java:341)
    at com.tongweb.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
    at com.tongweb.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
    at com.tongweb.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at com.tongweb.catalina.core.ThanosStandardEngineValve.invoke(ThanosStandardEngineValve.java:43)
    at com.tongweb.catalina.realm.RealmValve.invoke(RealmValve.java:21)
    at com.tongweb.catalina.connector.ThanosCoyoteAdaptor.service(ThanosCoyoteAdaptor.java:460)
    at com.tongweb.coyote.http11.Http11Processor.service(Http11Processor.java:780)
    at com.tongweb.coyote.http11.ThanosHttp11Processor.service(ThanosHttp11Processor.java:19)
    at com.tongweb.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at com.tongweb.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:923)
    at com.tongweb.web.util.net.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1613)
    at com.tongweb.web.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at com.tongweb.web.util.net.AbstractEndpoint.processSocket(AbstractEndpoint.java:853)
    at com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper$4.completed(Nio2Endpoint.java:643)
    at com.tongweb.web.util.net.Nio2Endpoint$Nio2SocketWrapper$4.completed(Nio2Endpoint.java:621)
    at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
    at sun.nio.ch.Invoker$2.run(Invoker.java:218)
    at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
    at com.tongweb.web.util.threads.TWThreadPoolExecutor.runWorker(TWThreadPoolExecutor.java:1172)
    at com.tongweb.web.util.threads.TWThreadPoolExecutor$Worker.run(TWThreadPoolExecutor.java:628)
    at com.tongweb.web.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

javax.persistence.spi.PersistenceProvider 这个类检索后,发现是属于hibernate-jpa-2.1-api-1.0.0.Final.jar里面的,但是tongweb的server.log还是会报错类找不到,排查好久,最终在日志调用栈上发现,疑似tongweb想自己去load相关class

 于是将hibernate-jpa-2.1-api-1.0.0.Final.jar丢到了tongweb根路径下的lib文件夹内,重启tongweb后解决了,国产化适配相关的资料太少了,防止后面的人有遇到相同的错误,这里还是记录一下。

  • 6
    点赞
  • 7
    收藏
  • 打赏
    打赏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:深蓝海洋 设计师:CSDN官方博客 返回首页
评论 9

打赏作者

天迹Ray

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值