[jboss-jira] [JBoss JIRA] (JBRULES-3437) SAXParseException configuring event listeners in spring

Mario Fusco (JIRA) jira-events at lists.jboss.org
Fri Mar 30 05:54:47 EDT 2012


Mario Fusco created JBRULES-3437:
------------------------------------

             Summary: SAXParseException configuring event listeners in spring
                 Key: JBRULES-3437
                 URL: https://issues.jboss.org/browse/JBRULES-3437
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: Mario Fusco
            Assignee: Mario Fusco


Part of my spring configuration:

<drools:ksession id="statefulSession" type="stateful" kbase="kbase1">        
           <drools:workingMemoryEventListener>
               <bean class="org.drools.event.DebugWorkingMemoryEventListener"/>
           </drools:workingMemoryEventListener>
           <drools:processEventListener>
               <bean class="org.drools.event.DebugProcessEventListener"/>
           </drools:processEventListener>         
</drools:ksession>

throws :

Caused by: org.xml.sax.SAXParseException; lineNumber: 15; columnNumber: 41;
cvc-complex-type.2.4.a: Invalid content was found starting with element
'drools:processEventListener'. One of
'{"http://drools.org/schema/drools-spring":workingMemoryEventListener,
"http://drools.org/schema/drools-spring":batch,
"http://drools.org/schema/drools-spring":script,
"http://drools.org/schema/drools-spring":configuration}' is expected.
 at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
 at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
 at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:387)
 at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:321)
 at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:421)
 at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3186)
 at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1810)
 at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:709)
 at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
 at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
 at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
 at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
 at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
 at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
 at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
 at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
 at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
 at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288)
 at
org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
 at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)

But following configuration is OK:

<drools:ksession id="statefulSession" type="stateful" kbase="kbase1">        
           <drools:processEventListener>
               <bean class="org.drools.event.DebugProcessEventListener"/>
           </drools:processEventListener>         
</drools:ksession>

Also this configuration is OK:

<drools:ksession id="statefulSession" type="stateful" kbase="kbase1">        
           <drools:workingMemoryEventListener>
               <bean class="org.drools.event.DebugWorkingMemoryEventListener"/>
           </drools:workingMemoryEventListener>       
</drools:ksession>


Exception occurs only when both listeners are configured.

probably because of bad position of elements; when listeners configured inside
<drools:ksession> as shown above, current order required:
agendaEventListener
processEventListener
workingMemoryEventListener

but when configured through <drools:eventListeners> element and listeners
attribute in <drools:ksession> element, order of event listeners does not
matter. I think this is because of <xsd:all> resp. <xsd:sequence> inside
drools-spring.xsd.

It would by nice to unite both styles of configuration.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list