java - java项目中的XML问题

标签 java xml spring

这是一个关于java项目中xml文件的问题。我有一个 spring 4 项目,可以从这里下载 - http://www.perfmath.com/spring/soba_zip/soba4_download_1.zip

在 src > main > webapp > web-inf > lib 下,soba-webflow.xml 文件给了我很多错误。我用谷歌搜索了这个并看到了类似的错误,但我没有找到针对我的情况纠正它的方法。请帮忙。

错误 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>

最佳答案

我下载了 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 的架构位置。

要解决此问题,您有 2 个选择:

选项 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 文件。

关于java - java项目中的XML问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23723413/

相关文章:

java - Spring Roo MySQL JDBC 驱动程序

java - 将 JscrollPane 添加到 Matlab 内的 JSPlitPane 中时,JscrollPane 不会收到 mousewheelevent

xml - VB.NET XML Linq 获取后代

javascript - 为每个 View 加载一个 Controller AngularJS

java - spring cloud配置客户端配置刷新不起作用

java - 运行ProcessBuilder后如何在指定位置生成输出文件 ("executable.exe", "InputFile").start()

java - 使用 appium 将元素滚动到 View 中不适用于 iOS

xmllint 没有返回我所期望的 -- n00b 警告

c - 如何使用 C 程序从 xml 文件中删除节点?

java - createCriteria 在没有 Activity 事务的情况下无效(Struts 2.3.15、Spring 3.2.4、Hibernate 4.2.5 Final)