有例外。 Spring 3 与 Spring Tool Suite、Tomcat 7 和 Maven
我是 Spring 3 的新手。我新安装了 Eclipse Indigo、Spring Tool Suite。 使用 Spring Tool Suite“Spring 模板 --> Spring MVC 项目”。我创建了一个 Hello world 应用程序。
运行应用程序时。它给出了一个例外。
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
org.apache.jsp.index_jsp._jspInit(index_jsp.java:31)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:181)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
设置有什么问题
I am new to Spring 3. I newly installed Eclipse Indigo, Spring Tool Suite.
Using Spring Tool Suite "Spring Template --> Spring MVC project". I created a Hello world application.
When running the application. It gives a exception.
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
org.apache.jsp.index_jsp._jspInit(index_jsp.java:31)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:181)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
What is wrong with the set up
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从
WEB-INF/lib
中删除任何el-api.jar
如果您在 IDE 中运行,则应该拥有
el-api.jar
code> 最多具有provided
范围。即使如此,它仍然可能会失败,因为 IDE 有时不考虑范围。我认为 m2e-wtp 插件应该可以修复它。Remove any
el-api.jar
fromWEB-INF/lib
If you are running from within the IDE, you should have the
el-api.jar
withprovided
scope at most. Even with that it may still fail, because the IDE sometimes doesn't take into account the scope. I think the m2e-wtp plugin should fix it.这是因为该模板是为带有 JSP 2.1 的 Tomcat 6.0 创建的,而 Tomcat 7.0 则与 JSP 2.2 一起使用。
正如您在此页面中看到的:
http://tomcat.apache.org/whichversion.html。
我尝试在 pom.xml 中将 jsp jar 更改为 2.2 并添加 el-api 2.2。但这还不够。我没有找到最后的问题。
最后我选择使用tomcat 6。
问候
it's because the template is created for Tomcat 6.0 with JSP 2.1 and Tomcat 7.0 works with JSP 2.2.
As you can see in this page:
http://tomcat.apache.org/whichversion.html.
I try to change the jsp jar for a 2.2 in the pom.xml and add the el-api 2.2. but it's not enought. I don't find the final problem.
Finally I choose to use the tomcat 6.
Regards
我遇到了同样的问题,并通过编辑 POM、将 jsp-api 版本从 2.1 更改为 2.2 来解决
I had the same problem and solved it by editing the POM, changing the jsp-api version from 2.1 to 2.2