Spring mvc 使用嵌入式jetty作为独立应用程序运行spring mvc时出错

Spring mvc 使用嵌入式jetty作为独立应用程序运行spring mvc时出错,spring-mvc,embedded-jetty,maven-assembly-plugin,Spring Mvc,Embedded Jetty,Maven Assembly Plugin,我有一个使用jetty作为独立应用程序运行SpringMVC应用程序的主类。我使用maven shade插件生成jar文件 我在运行jar文件时看到以下错误 org.eclipse.jetty.servlet.ServletHolder$1: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from ServletContext resource [/WEB

我有一个使用jetty作为独立应用程序运行SpringMVC应用程序的主类。我使用maven shade插件生成jar文件

我在运行jar文件时看到以下错误

org.eclipse.jetty.servlet.ServletHolder$1: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 106; cvc-elt.1: Cannot find the declaration of element 'beans'.
我的mvc-dispacher-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.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">


有谁能帮我找到缺失的地方吗?

通过在maven shade插件配置中添加以下内容,它就可以工作了

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
    <resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
    <resource>META-INF/spring.schemas</resource>
</transformer>

META-INF/spring.handlers
META-INF/spring.schemas

如果您的列表是完整的XML,那么就需要一个or。这只是我的mvc-dispacher-servlet.XML的一个片段