有例外。 Spring 3 与 Spring Tool Suite、Tomcat 7 和 Maven

发布于 2024-12-06 21:40:42 字数 1218 浏览 2 评论 0原文

我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

狠疯拽 2024-12-13 21:40:42

WEB-INF/lib 中删除任何 el-api.jar

如果您在 IDE 中运行,则应该拥有 el-api.jar code> 最多具有 provided 范围。即使如此,它仍然可能会失败,因为 IDE 有时不考虑范围。我认为 m2e-wtp 插件应该可以修复它。

Remove any el-api.jar from WEB-INF/lib

If you are running from within the IDE, you should have the el-api.jar with provided 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.

薄荷→糖丶微凉 2024-12-13 21:40:42

这是因为该模板是为带有 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

吻风 2024-12-13 21:40:42

我遇到了同样的问题,并通过编辑 POM、将 jsp-api 版本从 2.1 更改为 2.2 来解决

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.2</version>  <!-- 2.1 for Tomcat 6, 2.2 for Tomcat 7 -->
        <scope>provided</scope>
    </dependency>

I had the same problem and solved it by editing the POM, changing the jsp-api version from 2.1 to 2.2

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.2</version>  <!-- 2.1 for Tomcat 6, 2.2 for Tomcat 7 -->
        <scope>provided</scope>
    </dependency>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文