I am trying to do a POC to integrate Spring MVC with Drools.
My mvc-dispatcher-servlet.xml file tries to read the kie-spring.xsd file .
The file location on drools website gives 404.As a result the schema is not accessible and it gives warning as below.
"WARNING: Ignored XML validation warning org.xml.sax.SAXParseException; lineNumber: 25; columnNumber: 35; schema_reference.4: Failed to read schema document 'http://drools.org/schema/kie-spring.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not ."
The above warning seems to result in error at line 25 .I the file it shows error as "The matching wildcard is strict, but no declaration can be found for element 'kie:kmodule'." When Below is the error::
"SEVERE: Context initialization failed org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 25 in XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 25; columnNumber: 35; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'kie:kmodule'."
I found the same issue mentioned in another Stackoverflow question here. However the two solutions mentioned for it did not resolve the issue.
Below is the mvc-dispatcher-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 file:
<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>
I have made changes in settings.xml for http in my maven installation global and user settings.
Any feedback or suggestion is welcome.
Google for a suitable 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
Copy it to a location you can control. Change the URL.