Maven将项目部署到Tomcat-报错:java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

今天使用maven写SpringMvc,部署到tomcat时,遇到这样一个问题:

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
at org.springframework.web.servlet.support.JstlUtils.exposeLocalizationContext(JstlUtils.java:101)
at org.springframework.web.servlet.view.JstlView.exposeHelpers(JstlView.java:135)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)

于是思考了半天,终于找出来了,原来少导了jstl.jar.和standard.jar这两个jar包

1)在pom.xml文件里加入那两个jar的依赖,就可以了


javax.servlet
jstl
1.2


taglibs
standard
1.1.2

2)在本地仓库中创建文件夹,然后把jar包放进去 

发现在本地库中创建的文件夹名字和配置依赖的groupid、artifactid和version的关系了么....哈哈

Maven将项目部署到Tomcat-报错:java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config_第1张图片


javax.servlet.jl
jstl
1.1.2


taglibs.jl
standard
1.1.2

3)可以写死路径,not really understand yet!

Maven将项目部署到Tomcat-报错:java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config_第2张图片


添加成功之后,停止server, clear、package等,然后使用tomcat:run启动server


这两个jar包有什么作用呢?

standard.jar的作用
JSP 标准标签库,和jstl.jar 一起使用,在1.0的版本中,但在jstl-1.2.jar 就不在需要了。
如果你想在项目中使用JSTL和EL表达式,那么你必须要引入这个standard.jar文件。即使你没有引入,那MyEclipse工具自带的类库也会帮你倒入。


参考网址:http://www.cnblogs.com/buglove/p/5159093.html

你可能感兴趣的:(Maven将项目部署到Tomcat-报错:java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config)