将项目转换为spring5并将hibernate 5.2.17转换为在jboss 7.1 AP中运行时异常

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (41)

我正在将spring-web-mvc项目升级到spring5,JDK1.8和hibernate5.2.17。该项目编译并部署到Jboss 7.1.AP,但当我尝试登录该应用程序时,它给出以下错误:

ERROR [default task-2] aspect.ICAMExceptionHandler  - A NestedServletException has occured in the application
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.hibernate.Session.createSQLQuery(Ljava/lang/String;)Lorg/hibernate/query/NativeQuery;
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1006)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:881)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
    at io.undertow.servlet.handlers.security.ServletSecurityRo

pom.xml

</dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
             <version>5.2.17.Final</version>
            <!-- <version>3.3.2.GA</version>  -->

        </dependency>
        <dependency>
            <groupId>org.hibernate.common</groupId>
            <artifactId>hibernate-commons-annotations</artifactId>
            <version>5.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>5.2.17.Final</version>

一旦我将休眠降级到5.0.12.Final,我得到一个不同的错误

Apr 23 14:45:29 ERROR [default task-2] stderr  - java.lang.NullPointerException
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.hibernate.internal.util.collections.BoundedConcurrentHashMap.get(BoundedConcurrentHashMap.java:1851)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.hibernate.engine.query.spi.QueryPlanCache.getSQLParameterMetadata(QueryPlanCache.java:123)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.hibernate.internal.AbstractSessionImpl.createSQLQuery(AbstractSessionImpl.java:252)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.hibernate.internal.SessionImpl.createSQLQuery(SessionImpl.java:1914)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.dao.BaseDao.loadTransformedObjectWithNativeSQL(BaseDao.java:350)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.dao.ServiceDaoImpl.getUserValidation(ServiceDaoImpl.java:448)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at java.lang.reflect.Method.invoke(Method.java:498)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.sun.proxy.$Proxy116.getUserValidation(Unknown Source)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.services.ServiceLayerImpl.getUserValidation(ServiceLayerImpl.java:1800)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.services.security.SecuritySvcImpl.getUserValidation(SecuritySvcImpl.java:85)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.cmd.security.GetUserDetailsCmd.perform(GetUserDetailsCmd.java:77)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.cmd.security.GetUserDetailsCmd$$FastClassBySpringCGLIB$$4403c7d7.invoke(<generated>)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.cmd.security.GetUserDetailsCmd$$EnhancerBySpringCGLIB$$8d294553.perform(<generated>)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.controller.LegalController.printWelcome(LegalController.java:45)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.controller.LegalController$$FastClassBySpringCGLIB$$a04eb3fb.invoke(<generated>)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.aspect.ExceptionAspectHandler.handleControllerExceptionsWithAroundReturnString(ExceptionAspectHandler.java:45)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at java.lang.reflect.Method.invoke(Method.java:498)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:643)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:632)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at com.gee.gecs.cosmos.controller.LegalController$$EnhancerBySpringCGLIB$$ec0a9239.printWelcome(<generated>)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at java.lang.reflect.Method.invoke(Method.java:498)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:871)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:777)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:881)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
Apr 23 14:45:29 ERROR [default task-2] stderr  -    at org.springframework.web.servlet.FrameworkS
提问于
用户回答回答于

https://docs.oracle.com/javase/7/docs/api/java/lang/NoSuchMethodError.html

NoSuchMethodError is caused when the called method does not exists. In your case: org.hibernate.Session.createSQLQuery(String)

请检查Hibernate的版本是否有效用于其他库。

听起来像兼容性问题。

热门问答

智能钛能处理大数据文件吗?我有30G的数据存储在本地电脑硬盘上?

腾讯智能钛AI开发者

腾讯云 · 智能钛产品团队 (已认证)

腾讯智能钛产品团队官方运营账号。分享产品最新动态,第一时间解答用户疑问。
推荐

硬盘可以升级吗?

最爱开车啦互联网的敏感者
推荐

可以升级,小微活动中没有云硬盘的的,后续可以用同帐号在官网购买和服务器同地域同地区的云硬盘挂载到服务器上使用。

云硬盘挂载初始化方法 可参考 https://cloud.tencent.com/document/product/362/6735

云通信 70402 错误?

推荐已采纳

参数非法,请检查必填字段是否填充,或者字段的填充是否满足协议要求。

您好,可参考此文档:https://cloud.tencent.com/document/product/269/1671

录音识别sdk的录音文件如何保存?

Richel码农
推荐

1.实时语音sdk内置录音器采集音频暂不支持保存语音数据,如需要保存语音数据建议上层自行采集音频数据。

2.实时语音识别sdk不支持暂停&继续操作,停止识别后重新调用start即开始识别。

云通讯im 本地消息存储数据库能否开放使用,要做一个本地聊天记录搜索功能?

推荐
您好,首先核实下您是否咨询app本地存储?App 本地存储;默认情况下,SDK 内部会对收到的消息进行存储,无需用户进行存储。用户可调用接口获取本地消息(无网络操作),另外,通过 getMessage 接口,也会获取本地消息,如果本地消息存在断层,会通过漫游消息补全。消息存储详参...... 展开详请

服务器操作台不是Windows咋换?

蒋小爱

腾讯云 · 技术支持 (已认证)

推荐
您好,您参考重装Windows系统;仅支持中国大陆地域(不含香港)。例如,Linux 重装为 Windows,Windows 重装为 Linux 。 登陆控制台 图片.png 选择【公共镜像】中Windows ,配置Windows密码,点击【开始重装】即可更换Windows 图片...... 展开详请

所属标签

扫码关注云+社区

领取腾讯云代金券