问题描述
我正在查看旧的web.xml的web-app标签(在下面列出),感觉很不对劲。具体来说,它似乎同时引用了web-app_3_1.xsd和web-app_2_5.xsd。
我的直觉告诉我,应该删除2_5.xsd部分,但是我对web.xml背后的理论了解不够,无法对其进行故障排除。我欢迎您提出建议。
在相关的情况下:
- 此web.xml用于Spring REST服务。
- Bootstrapservletcontextlistener只是一个侦听器,它向Webapp类加载器中的URL添加了许多库jar。
- Java 11,Tomcat 9,Spring 4.2.6。最初是为Java 8,Tomcat 8编写的。
- 我当前看到错误消息“名称空间[http://www.springframework.org/schema/context]的类[org.springframework.context.config.ContextNamespaceHandler]无法实现[org.springframework.beans。 “ factory.xml.NamespaceHandler]接口”,尽管我记得几个月前看到该应用程序在此环境中运行良好(我也查看了Spring 4.2.6,该类实现了接口 。 ,我在环境中的任何地方都看不到任何其他版本的Spring。)
最后,web.xml代码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<web-app id="WebApp_ID" version="3.1"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:web="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd
http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>restAuth</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/restAuth*.xml,classpath*:restAuth*.xml</param-value>
</context-param>
<listener>
<listener-class>net.cndc.bootstrap.web.Bootstrapservletcontextlistener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<description>Spring Security Request Filter</description>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>restAuth</servlet-name>
<servlet-class>org.springframework.web.servlet.dispatcherServlet</servlet-class>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>restAuth</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Force SSL for entire site -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
</web-app>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)