问题
I'm trying to create spring roo application with Drools. But I faced with errors in applicationContext.xml.
Error:
Multiple annotations found at this line: - Unable to locate Spring NamespaceHandler for element 'drools:execution-node' of schema namespace 'http://drools.org/schema/ drools-spring' - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'drools:execution-node'.
this is a piece of applicationContext.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring.xsd">
while connecting drools i review this sources: http://www.packtpub.com/article/drools-integration-modules-spring-framework-apache-camel http://blog.mersoft.com/2011/09/07/getting-started-with-drools-5-2 http://docs.jboss.org/drools/release/5.4.0.Final/droolsjbpm-integration-docs/html_single/index.html#d0e666
Maybe they will help someone.
hear is the drools bean
<drools:execution-node id="node1" />
<drools:resources>
<drools:resource type="XSD" source="classpath:model.xsd"/>
<drools:resource type="DRL" source="classpath:test.drl"/>
</drools:resources>
Please help me to configure name spaces. and give me more links about Drools spring integration and xml name spaces.
回答1:
The reason you are getting the error is because http://drools.org/schema/drools-spring.xsd doesn't serve. If you find a URI that serves it properly, your error should go away. An example URI I've found is http://grepcode.com/file_/repository.jboss.org/nexus/content/repositories/releases/org.drools/drools-spring/5.6.0.Final/org/drools/container/spring/drools-spring.xsd/?v=source
I'm trying to find a more reliable reference through in the following stack overflow question: Location of drools-spring.xsd on git hub
回答2:
I suspect that the issue is that you're using Spring 3.1, but making use of drools-spring XML config, which loads in some pretty old and derepit Spring dependencies.
I would recommend avoiding the use of the drools-spring XML configuration. Just configure a Spring bean to contain your knowledge base and act as the interface to it.
来源:https://stackoverflow.com/questions/11486747/configure-drools-with-spring-xsd-errors