本文介绍了前缀"xsi"指的是"xsi".对于属性"xsi:schemaLocation"与元素类型"web-app"相关联.没有约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动tomcat时出现错误:

Error Seen while starting tomcat:

我正在尝试将Java(基于Maven)项目部署到Tomcat 8服务器上并启动它.清理完所有项目并构建工作区之后;删除每个项目上的所有构建路径错误之后.当我尝试在tomcat中部署项目并启动它时,出现以下错误:

I am trying to deploy my Java (Maven Based) projects onto my Tomcat 8 server and start it. After cleaning all the project and building the workspace; After removing all build path errors on each project. When I try to deploy the projects in tomcat and start it, i get below error:

    Apr 02, 2018 1:29:22 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [action] in web application [/bss] threw load() exception
javax.servlet.UnavailableException: org.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:schemaLocation" associated with an element type "web-app" is not bound.
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140)

我不确定是什么原因导致该问题,以及确切缺少哪个jar可以解决此问题.

I am not sure what is causing the issue and which jar is exactly missing which will resolve this issue.

推荐答案

您很可能在 web.xml 文件中缺少 xsi 命名空间的声明.将 xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" 添加到 web-app 元素.示例:

You are most probably missing the declaration of the xsi namespace in your web.xml file. Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" to the web-app element. Example:

<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/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5">
   <!-- ... -->
</web-app>

这篇关于前缀"xsi"指的是"xsi".对于属性"xsi:schemaLocation"与元素类型"web-app"相关联.没有约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 01:16