Spring XSD的访问错误
我正在尝试在我的工作中运行一名前雇员留下的系统,但我遇到了问题。
如果XSD通过远程访问运行:
它给出了一个未找到的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通过本地访问运行:
它给出了这个例外:
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)
有些想法可以解决这个问题吗?
大拥抱!!
Spring XDS定义并随Spring jar一起发货! 例如, spring-context.jar
包含spring-context-3.0.xsd
。 (参见spring-context.jar
/META-INF/spring.schema)
所以检查你的项目中是否有这个jar。
所谓你所谓的“远程”并不是很遥远! 我从来没有看到你所谓的“本地访问”,所以我会尝试检查为什么“远程”(不是远程)的东西适用于所有xsds而不是spring-context。
如果它是桌面程序并且您使用包含所有其他爆炸jar的单个jar,那么您需要注意来自不同spring-xxx.jar的单个spring.handlers
和spring.schames
文件的内容是组合在(两个)“hunge”文件中。 因此,最后这个(两个)文件包含所有模式名称和处理程序名称。
确实,SPRING XSD与jar子一起出货。
存储这些XSD的信息:
-
让我们说在XML文件中,我们使用了bean命名空间,我们需要深入研究
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-
请检查META-INF文件夹中的文件“spring-schemas”spring-beans-4.0.1.RELEASE.jar。 此文件的示例上下文应为:
http\://www.springframework.org/schema/beans/spring-beans-4.0.xsd =org/springframework/beans/factory/xml/spring-beans-4.0.xsd http\://www.springframework.org/schema/beans/spring-beans.xsd =org/springframework/beans/factory/xml/spring-beans-4.0.xsd
-
从而
http\://www.springframework.org/schema/beans/spring-beans.xsd is mapped to org/springframework/beans/factory/xml/spring-beans-4.0.xsd
在你的jar子里
尝试运行wget http://www.springframework.org/schema/context/spring-context-3.0.xsd 。
should be something like: wget http://www.springframework.org/schema/context/spring-context-3.0.xsd --2012-09-10 15:56:05-- http://www.springframework.org/schema/context/spring-context-3.0.xsd Resolving www.springframework.org... 205.140.197.88 Connecting to www.springframework.org|205.140.197.88|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 19651 (19K) [text/xml] Saving to: “spring-context-3.0.xsd” 100%[=====================================================================>] 19,651 24.6K/s in 0.8s 2012-09-10 15:56:06 (24.6 KB/s) - “spring-context-3.0.xsd” saved [19651/19651]
如果您在获取xsd架构时遇到问题,则很难使用inheritance此架构的xml文件。
在第二种情况下,你只是在classpath中没有任何spring – * – 3.0.xsd文件。
- Java:catch的意义(最终的SomeException e)?
- iText Java签名PDF DocumentException:空间不足
- JSF 1.2动作exception和actionListener之间的区别
- Java PatternSyntaxException:字符串替换非法重复?
- 在Java中捕获Throwable的最佳实践
- .Jar文件在netbeans中运行,但在外部打开时不运行
- 将ExceptionDescribe转换为字符串
- 当JMS Prod位于帮助程序POJO类中时,如何在事务中包含JMS生产者
- java.lang.ArrayIndexOutOfBoundsException:length = 0; index = 0 – 数据库阅读 – Android