【问题标题】:The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'. StandardWrapper.Throwable匹配的通配符是严格的,但找不到元素“mvc:annotation-driven”的声明。 StandardWrapper.Throwable
【发布时间】:2018-04-12 01:20:54
【问题描述】:

全部 我正在开发一个简单的登录项目,并试图让应用程序在 tomcat 服务器中运行,我也遇到了“无法更改项目方面动态 Web 模块版本错误”的几个问题。”试图通过更改模块的版本并确保也存在适当的java jee。但失败了。现在有这个服务器上下文初始化失败错误。还有。有人可以帮我吗。 提前致谢

SampleLoginApp-servlet.xml:

enter code here

<?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.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">


    <context:component-scan base-package="com.sample.Controller"></context:component-scan>
    <mvc:annotation-driven></mvc:annotation-driven>


    <bean id="jspviewresolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsps/"></property>
        <property name="suffix" value=".html"></property>
    </bean>
</beans>

web.xml

在此处输入代码

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>SampleLoginApp</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <description></description>
        <display-name>SampleLoginApp</display-name>
        <servlet-name>SampleLoginApp</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>SampleLoginApp</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>


</web-app>

【问题讨论】:

    标签: java spring maven tomcat jakarta-ee


    【解决方案1】:

    在您的SampleLoginApp-servlet.xml 中,您已声明xmlns:mvc="http://www.springframework.org/schema/mvc"

    我没有看到为它定义了 xsi:schemaLocation。您可以尝试添加以下行吗

    "http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd"
    

    【讨论】:

    • 感谢帮助,现在控制台显示,没有错误,但是tomcat除了显示错误外,不会在本地主机上显示任何东西。
    • 现在,问题出在其他地方。你能发布控制器类和你得到的错误吗?
    猜你喜欢
    • 2014-11-18
    • 2011-08-28
    • 2016-04-19
    • 1970-01-01
    • 2018-03-21
    • 1970-01-01
    • 1970-01-01
    • 2012-08-26
    • 2021-11-02
    相关资源
    最近更新 更多