您的位置:首页 > 编程语言 > Java开发

Spring+SpringMVC+MyBaties问题总结(二

2016-05-05 11:48 591 查看
问题5、启动服务时报以下异常

nested exception is java.lang.NoSuchMethodError:  o
rg.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V[/code]

解决方法:引入的spring 相关jar包中存在多个版本问题,仔细排除即可。

问题6、启动tomcat服务时,数据源连接的url和指定的url莫名的不一致,报的异常是本机ip

解决方法:db配置文件的username或password后面有空格,删除空格;或者是因为配置文件的编码格式与项目编码格式不统一。

问题7、spring版本由4.0.4升级到4.1.1,项目启动时报异常:

java.lang.ClassNotFoundException: org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
解决方法:4.0.4升级到4.1.1后,spring-web.jar中没有了MappingJacksonHttpMessageConverter类

添加以下依赖包后,该问题解决,不知道为什么,有知道的大侠给解释下。

<dependency>

<groupId>com.fasterxml.jackson.core</groupId>

<artifactId>jackson-databind</artifactId>

<version>2.5.0</version>

</dependency>

问题8、解决了问题7后,访问首页出现以下异常

严重: Servlet.service() for servlet [jsp] in context with path [/FHM] threw exception [javax.servlet.ServletException: Servlet execution threw an exception] with root cause

java.lang.NoSuchFieldError: STANDARD_NUMBER_TYPES

at org.springframework.web.context.request.ServletRequestAttributes.<clinit>(ServletRequestAttributes.java:55)

at org.springframework.web.servlet.FrameworkServlet.buildRequestAttributes(FrameworkServlet.java:1026)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
...

严重: Servlet.service() for servlet [jsp] in context with path [/---] threw exception [javax.servlet.ServletException: Servlet execution threw an exception] with root cause

java.lang.NoClassDefFoundError: Could not initialize class org.springframework.web.context.request.ServletRequestAttributes

at org.springframework.web.servlet.FrameworkServlet.buildRequestAttributes(FrameworkServlet.java:1026)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:719)

at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:465)

at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:390)

at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:317)
解决方法:maven库中的包与项目中WEB-INF/lib中存在版本不一致的包(删除lib下4.0.4相关的jar包后解决问题)。

问题9、点击登录按钮出现以下异常

严重: Servlet.service() for servlet [springMvc] in context with path [/FHM] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonGenerator.setCurrentValue(Ljava/lang/Object;)V] with root cause

java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonGenerator.setCurrentValue(Ljava/lang/Object;)V

at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:445)

at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:29)
解决方法:依赖包json-core需要对应的升级到2.5.0
ps:如问题8一样,如果WEB-INF/lib中存在不一致的版本jar,需要将其删除。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: