4 Replies Latest reply on Sep 11, 2008 12:41 PM by mike_ap

    Smooks condition error

      I'm setting up a condition following the huge-split-route quickstart example. my config looks like this:

       <resource-config selector="csv-record">
       <resource>org.milyn.routing.db.SQLExecutor</resource>
       <condition>
       <!--
       tagExistsRS[0].found < 1
       -->
       </condition>
       <param name="executeBefore">false</param>
       <param name="datasource">myDS</param>
       <param name="statement">INSERT INTO ... </param>
       </resource-config>
      


      But I get the following error. What am I missing? Is the example code old? Is there a bug?

      
      Caused by: org.xml.sax.SAXParseException: cvc-complex-type.4: Attribute 'evaluator' must appear on element 'condition'.
       at com.sun.org.apache.xerces.internal.jaxp.validation.Util.toSAXParseException(Util.java:109)
       at com.sun.org.apache.xerces.internal.jaxp.validation.ErrorHandlerAdaptor.error(ErrorHandlerAdaptor.java:104)
       at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
       at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3185)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.addDefaultAttributes(XMLSchemaValidator.java:2910)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2098)
       at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
       at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:335)
       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
       at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.process(ValidatorImpl.java:192)
       at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:159)
       at javax.xml.validation.Validator.validate(Validator.java:82)
       at org.milyn.xml.XmlUtil.parseStream(XmlUtil.java:305)
       at org.milyn.cdr.XMLConfigDigester.digestConfig(XMLConfigDigester.java:84)
       at org.milyn.cdr.XMLConfigDigester.digestConfig(XMLConfigDigester.java:68)
       at org.milyn.cdr.SmooksResourceConfigurationStore.registerResources(SmooksResourceConfigurationStore.java:212)
       at org.milyn.Smooks.addConfigurations(Smooks.java:182)
       at org.milyn.Smooks.addConfigurations(Smooks.java:155)
       at org.milyn.Smooks.<init>(Smooks.java:112)
       at org.jboss.soa.esb.actions.smooks.SmooksAction.<init>(SmooksAction.java:115)
       ... 57 more
      



        • 1. Re: Smooks condition error

          by the way, I tried setting the evaluator attribute to org.milyn.javabean.expression.MVELExpressionEvaluator

          but I get this. I'm using standard Jboss ESB 4.3 so I assume I should have all the classes required.

          Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.milyn.javabean.expression.MVELExpressionEvaluator
          


          • 2. Re: Smooks condition error

            I also tried setting evaluator to org.milyn.expression.MVELExpressionEvaluator

            but I get this error:

            Caused by: org.milyn.cdr.SmooksConfigurationException: Unsupported ExpressionEvaluator type 'org.milyn.expression.MVELExpressionEvaluator'. Currently
             only support 'org.milyn.expression.ExecutionContextExpressionEvaluator' implementations.
            


            Can someone give me a working example using conditions in Smooks?

            Thank you

            • 3. Re: Smooks condition error
              tfennelly

              Hi... try setting the condition evaluator class name to "org.milyn.javabean.expression.BeanMapExpressionEvaluator". This attribute is mandatory in Smooks v1.0 and before, but not in v1.0.1, where it is defaulted to "org.milyn.javabean.expression.BeanMapExpressionEvaluator". Sounds like you're using a JBossESB 4.4 example (Smooks v1.0.1) example on an older version of the ESB (and Smooks). So Smooks v1.0.1 is backward compatible, but not forward compatible :-)

              • 4. Re: Smooks condition error

                Thanks! That did it.