这是关于java项目中的xml文件的问题。我有一个spring 4项目,可以从这里下载 - http://www.perfmath.com/spring/soba_zip/soba4_download_1.zip
在src>下主要> webapp> web-inf> lib,soba-webflow.xml
文件给了我很多错误。我用Google搜索并看到类似的错误,但我没有找到一种方法来纠正它。请帮忙。
错误1 -
Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'webflow:flow-registry'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.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>.
错误2 -
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'webflow:flow-executor'.
xml文件中的代码段 -
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd">
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping" >
<property name="flowRegistry" ref="flowRegistry" />
<property name ="order" value="1" />
</bean>
<bean name="flowHandlerAdapter" class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<webflow:flow-registry id="flowRegistry">
<webflow:flow-location
path="/WEB-INF/flows/onlineService/onlineService.xml" />
<webflow:flow-location
path="/WEB-INF/flows/customerSearch/customerSearch.xml" />
<webflow:flow-location
path="/WEB-INF/flows/customerDetails/customerDetails.xml" />
<webflow:flow-location
path="/WEB-INF/flows/transferMoney/transferMoney.xml" />
</webflow:flow-registry>
<webflow:flow-executor id="flowExecutor">
<webflow:flow-execution-listeners>
<webflow:listener ref="securityFlowExecutionListener" />
<webflow:listener ref="jpaFlowExecutionListener" />
</webflow:flow-execution-listeners>
</webflow:flow-executor>
答案 0 :(得分:2)
我下载了soba4_download_1.zip并观察到在pom.xml元素中你引用的是2.3.3版本的webflow:
<spring.webflow.version>2.3.3.RELEASE</spring.webflow.version>
但是在你的soba-webflow.xml中,你指的是spring-webflow-config-2.4.xsd的模式位置。
要解决此问题,您有两个选择:
选项1:
由于您已拥有2.3.3 webflow版本,请将spring-webflow-config架构位置更改为:
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
选项2:
升级到webflow 2.4版本。在spring-webflow-2.4.0.RC1.jar中,您包含了spring-webflow-config-2.4.xsd文件。
答案 1 :(得分:0)
如果从IDE中收到这些错误,请确保可以从中访问架构文档http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
(网络连接,代理设置等)。我可以在Eclipse中成功加载XML。