使用int-groovy:script标记时解析异常

时间:2013-01-09 13:58:12

标签: groovy xml-parsing xsd spring-integration

我正在开发Spring Integration项目并使用Groovy编写示例转换器。下面给出的是Spring配置文件中的示例 -

<int:transformer input-channel="channel8" output-channel="channel9">
   <int-groovy:script>
        <![CDATA[
        if (!payload.equals('hello')) {
            throw new RuntimeException('invalid payload')
        }
        payload
         ]]>

    </int-groovy:script>    

</int:transformer>

我已导入以下命名空间,并且Eclipse编辑器中的xml Spring配置文件没有显示错误。

xmlns:int-groovy =“http://www.springframework.org/schema/integration/groovy”

但是在运行我的程序时,我看到以下错误 -

Caused by: org.xml.sax.SAXParseException; lineNumber: 60; columnNumber: 24; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'int-groovy:script'.
  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(XMLErrorRep‌​orter.java:437)

我不确定我在这里缺少什么。对此有任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

我认为你错过了运行时路径中的'spring-integration-groovy-x.x.x.RELEASE.jar'文件