Spring XSD的访问错误 [英] Spring XSD's access error
问题描述
我正在尝试在我的工作中运行一名前雇员留下的系统,但我遇到了问题。
I'm trying to run a system left by an ex-employee here in my job, but I'm having problems to do it.
如果是XSD通过远程访问运行:
If the XSD runs by remote access:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
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-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
它给出了一个未找到的例外:
It gives an not found exception:
Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
如果XSD通过本地访问运行:
And if the XSD runs by local access:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
classpath:org/springframework/beans/factory/xml/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
classpath:org/springframework/transaction/config/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
classpath:org/springframework/context/config/spring-context-3.0.xsd
http://www.springframework.org/schema/tool
classpath:org/springframework/beans/factory/xml/spring-tool-3.0.xsd">
它给出了这个例外:
C:\Users\claudiomazur>java -jar c:\temp\fin\c.jar
0 [AWT-EventQueue-0] INFO support.ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4fa52fdf: startup date [Thu Sep 06
11:22:59 BRT 2012]; root of context hierarchy
45 [AWT-EventQueue-0] INFO xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [context.xml]
Exception in thread "AWT-EventQueue-0" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [context.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
有什么想法解决这个问题?
Some idea to solve this problem?
大抱抱!!
推荐答案
Spring XDS已经定义并随Spring jar一起发货!例如, spring-context.jar
包含 spring-context-3.0.xsd
。 (参见 spring-context.jar
/META-INF/spring.schema)
The Spring XDSs are defined and shipped with the Spring jars! For Example the spring-context.jar
contains the spring-context-3.0.xsd
. (see spring-context.jar
/META-INF/spring.schema)
所以检查你是否有这个你项目中的jar。
So check that you have this jar in your project.
所谓你所谓的远程并不是很遥远!我从来没有看到你所谓的本地访问,所以我会尝试检查为什么远程(不是远程)的东西适用于所有xsds但是弹簧上下文。
So what you called "remote" is not really remote! And I have never see what you called "local access", so I would try to check why the "remote" (that is not remote) stuff works for all xsds but the spring-context.
如果是桌面程序并且您使用包含所有其他爆炸罐的单个jar,那么您需要注意单个内容 spring.handlers
和 spring.schames
来自不同spring-xxx.jar的文件在(两个)hunge中组合文件。因此,最后这个(两个)文件包含所有模式名称和处理程序名称。
If it is a desktop program and you use a single jar that contains all the other exploded jars, then you need a to take care that the content of the single spring.handlers
and spring.schames
files from the different spring-xxx.jar is COMBINED in (two) "hunge" files. So that in the end this (two) files contains all the schema names and handler names.
这篇关于Spring XSD的访问错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!