0

我是 Spring MVC 的新手。(我知道 Struts MVC,但我需要学习 Spring MVC。)我试图让我的应用程序的首页(位于 /WEB-INF/jsp/Welcome.jsp)出现,但我收到以下消息:

HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: java.lang.VerifyError: (class: org/apache/jasper/runtime/JspApplicationContextImpl, method: createELResolver signature: ()Ljavax/el/ELResolver;) Incompatible argument to function
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1265)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1016)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:965)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:781)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

java.lang.VerifyError: (class: org/apache/jasper/runtime/JspApplicationContextImpl, method: createELResolver signature: ()Ljavax/el/ELResolver;) Incompatible argument to function
    org.apache.jasper.runtime.JspFactoryImpl.getJspApplicationContext(JspFactoryImpl.java:200)
    org.apache.jsp.WEB_002dINF.jsp.Welcome_jsp._jspInit(Welcome_jsp.java:25)
    org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1265)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1016)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:965)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:781)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>Job Connections Bulletin Board</display-name>

    <servlet>
        <servlet-name>jcbulboard</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>jcbulboard</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>Welcome.jsp</welcome-file>
    </welcome-file-list>
</web-app>

jcbulboard-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

    <context:annotation-config />

    <context:component-scan base-package="com" />

    <mvc:annotation-driven />

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>
</beans>

家庭控制器.java

package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController {
    @RequestMapping(value = "/")
    public String home() {
        return "WEB-INF/jsp/Welcome";
    }
}
4

1 回答 1

0

我相信我已经解决了这个问题。我在 Tomcat 7 下运行,但我认为我有 Tomcat 6 的 jars。我已经在我的 lib 文件夹中替换了它们,并且该错误消息已经消失。

于 2013-03-14T00:38:19.103 回答