我有一个使用maven构建的
spring项目(打包为jar)(依赖项被复制到一个单独的目录并添加到classpath中)
我想以java -jar的形式运行它
问题是当我运行它时,我得到:
导致:org.xml.sax.SAXParseException:cvc-elt.1:找不到声明
元素“豆”.
这是因为spring.schemas和spring.handlers位于几个jar,即:spring-beans等
有没有办法解决它,假设我不想使用阴影插件来解压缩所有依赖项并连接spring.schemas和spring.handlers的内容?
我还要避免在我的项目中保存xsd文件,并将schemaLocation更改为指向我的位置.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <camel:camelContext> <camel:routeBuilder ref="fakeRouteBuilder"/> </camel:camelContext> <bean id="fakeRouteBuilder" class="<className>" /> </beans>
我知道2种情况,你可以有这个问题
>如果您没有互联网连接(例如在代理之后).在这种情况下,请下载XSD,将其复制到XML旁边,并将模式位置更改为xsi:schemaLocation =“http://www.springframework.org/schema/beans spring-beans-2.5.xsd …”>如果您有互联网连接/仍然有问题,那是因为您使用不同版本的Spring for XSD和jar.
原文地址:https://www.jb51.cc/xml/292879.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。