简体   繁体   English

Jetty的XML模式错误

[英]XML schema error with Jetty

I got a problem with my spring configuration when I run it in jetty. 在码头上运行时,我的弹簧配置出现问题。 I used the exact same file in tomcat without any problems. 我在tomcat中使用了完全相同的文件,没有任何问题。 The error i get is the following. 我得到的错误如下。

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from ServletContext resource [/WEB-INF/web-application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'SpringSource.org | '.
Caused by: org.xml.sax.SAXParseException: s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'SpringSource.org | '.

My schema looks like this. 我的架构如下所示。

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.5.xsd">

I have no idea what can be wrong. 我不知道有什么问题。 Have tested it with 2 different configurations and both gave this error. 已使用2种不同的配置对其进行了测试,并且都给出了此错误。

The following URL seems invalid, and redirects to springsource.org 以下网址似乎无效,并重定向到springsource.org

http://www.springframework.org/schema/security/spring-security-3.0.5.xsd

Can you try that one? 你可以试试那个吗?

http://www.springframework.org/schema/security/spring-security-3.0.4.xsd

I think it is the spring security part that is messing this up look at Spring 3.0 - Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] for a solution. 我认为正是Spring安全性部分使Spring 3.0陷入困境-无法找到XML模式名称空间的Spring NamespaceHandler [http://www.springframework.org/schema/security]作为解决方案。 (Short recap you are missing the Spring Security Config jar in your classpath add the below dependency if you are using maven) (简短地回顾一下,如果您使用的是maven,则在类路径中缺少Spring Security Config jar,请添加以下依赖项)

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>3.0.1.RELEASE</version>
</dependency>

Obviously you can not have a newline character inside XML attribute. 显然,XML属性中不能包含换行符。

Put xsi:schemaLocation attribute value all inside one line. xsi:schemaLocation属性值全部放在一行中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM