流口水-弹簧 MVC 集成 |无法读取架构文档 |找不到元素'kie:kmodule'的声明



我正在尝试做一个POC来将Spring MVC与Drools集成。

我的mvc-dispatcher-servlet.xml文件尝试读取kie-spring.xsd文件。

drools网站上的文件位置给出404。因此,该架构不可访问,并给出如下警告。

"警告:忽略XML验证警告org.xml.ax.SAXParseException;行号:25;columnNumber:35;schema_rereference.4:读取架构文档"失败http://drools.org/schema/kie-spring.xsd',因为1)找不到该文档;2) 文件无法阅读;3) 文档的根元素不是。">

上述警告似乎导致第25行出现错误。在文件中,它显示错误为"匹配的通配符是严格的,但找不到元素'kie:kmodule'的声明。"当出现以下错误时::

"严重:上下文初始化失败org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:ServletContext资源[/WEB-INF/mvc dispatcher servlet.xml]的xml文档中的第25行无效;嵌套异常为org.xml。ax.SAXParseException;行号:25;columnNumber:35;cvc复杂类型2.4.c:匹配的通配符是严格的,但找不到元素"kie:kmodule"的声明。">

我在这里发现了另一个Stackoverflow问题中提到的相同问题。然而,为它提到的两种解决方案并没有解决这个问题。

下面是mvc调度器servlet.xml::

<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:kie="http://drools.org/schema/kie-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd">
<context:component-scan base-package="com.kiespring.mvc.controller" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean id="kieUtil" class="org.kie.spring.KieSpringUtil"/>
<kie:kmodule id="sample_module">
<kie:kbase name="kbase1" packages="org.drools.spring.sample"/>
</kie:kmodule>
<bean id="kiePostProcessor" class="org.kie.spring.KModuleBeanFactoryPostProcessor"/>
</beans>

POM文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.kie.sample</groupId>
<artifactId>kie-springmvc</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>kie-springmvc Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
<kie.spring.version>6.0.1.FINAL</kie.spring.version>
</properties>
<dependencies>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
<version>${kie.spring.version}</version>
</dependency>
</dependencies>
<build>
<finalName>kie-springmvc</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

我在maven安装全局和用户设置中对settings.xml中的http进行了更改。

欢迎任何反馈或建议。

谷歌搜索合适的kie-spring.xsd.E.g:

github.com/kiegroup/droolsjbpm-integration/blob/master/kie-spring-src/main/resources/org/kie/spring-kie-spring 6.0.0.xsd

将其复制到您可以控制的位置。更改URL。

最新更新