Announcement Announcement Module
Collapse
No announcement yet.
Attribute 'expression' is not allowed to appear in element 'int:transformer'. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Attribute 'expression' is not allowed to appear in element 'int:transformer'.

    I am trying to run spring integration 2.2.0 version and getting the following error:

    Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefin itionStoreException: Line 63 in XML document from class path resource [META-INF/spring/integration/tcpClientServerDemo-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 63; columnNumber: 37; cvc-complex-type.3.2.2: Attribute 'expression' is not allowed to appear in element 'int:transformer'.
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:396)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:302)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:174)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:209)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:180)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:243)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:127)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:93)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:131)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:530)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:444)
    at com.abc.bda.tcp.TelnetServer.performRole(TelnetSer ver.java:36)
    at com.abc.bda.tcp.ZooElectableClient.determineAndPer formRole(ZooElectableClient.java:215)
    at com.abc.bda.tcp.ZooElectableClient.run(ZooElectabl eClient.java:224)
    at com.abc.bda_producer.App.main(App.java:40)
    Caused by: org.xml.sax.SAXParseException; lineNumber: 63; columnNumber: 37; cvc-complex-type.3.2.2: Attribute 'expression' is not allowed to appear in element 'int:transformer'.
    at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.createSAXParseException(ErrorHandlerWrap per.java:198)
    at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.error(ErrorHandlerWrapper.java:134)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(XMLErrorReporter.java:387)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(XMLErrorReporter.java:321)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator$XSIErrorReporter.reportError(XMLSchema Validator.java:421)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.reportSchemaError(XMLSchemaValidator.j ava:3186)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.processAttributes(XMLSchemaValidator.j ava:2663)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.handleStartElement(XMLSchemaValidator. java:2070)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSche maValidator.emptyElement(XMLSchemaValidator.java:7 29)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocum entScannerImpl.scanStartElement(XMLNSDocumentScann erImpl.java:353)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl$FragmentContentDriver.next(XM LDocumentFragmentScannerImpl.java:2732)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl.next(XMLDocumentScannerImpl.java:625)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocum entScannerImpl.next(XMLNSDocumentScannerImpl.java: 116)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(XMLDocumentFragm entScannerImpl.java:488)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:819)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:748)
    at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(XMLParser.java:123)
    at com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse(DOMParser.java:239)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBu ilderImpl.parse(DocumentBuilderImpl.java:288)
    at org.springframework.beans.factory.xml.DefaultDocum entLoader.loadDocument(DefaultDocumentLoader.java: 75)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:388)
    ... 15 more



    My xml looks like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:int="http://www.springframework.org/schema/integration"
    	xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
    		http://www.springframework.org/schema/integration http://www.springframework.org/schem...ntegration.xsd
    		http://www.springframework.org/schema/integration/ip http://www.springframework.org/schem...gration-ip.xsd
    				http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    
    	<context:property-placeholder />
    	
    	<!-- Server side -->
    
    	<int-ip:tcp-connection-factory id="crLfServer"
    		type="server"
    		port="${availableServerSocket}"/>
    
    	<int-ip:tcp-inbound-gateway id="gatewayCrLf"
    		connection-factory="crLfServer"
    		request-channel="serverBytes2StringChannel"
    		error-channel="errorChannel"/>
    
    	<int:channel id="toSA" />
    
    	<int:service-activator input-channel="toSA"
    		ref="kafkaProducerService"
    		method="delegate"/>
    
    	<bean id="kafkaProducerService"
    		class="com.abc.bda.tcp.KafkaProducerService" />
    
    	<int:transformer id="serverBytes2String"
    				input-channel="serverBytes2StringChannel"
    		output-channel="toSA"
    		expression="new String(payload)"/>
    
    
    	<int:transformer id="errorHandler"
    		input-channel="errorChannel"
    		expression="payload.failedMessage.payload + ':' + payload.cause.message"/>
    
    </beans>
    Please help on this.

    Thanks in advance.

    Rakesh Kumar Rakshit
    Last edited by ihavethepotential; Apr 4th, 2013, 05:09 AM.

  • #2
    When posting code and config, please use [ code ] ... [ /code ] tags (no spaces in brackets). I edited your post.

    You probably have an old (1.0.x) jar on your classpath.

    Run with -verbose and you'll see which jar classes are being loaded from.

    Comment


    • #3
      Hi Gary,

      I have checked out the jars. I do not have any old jar in my classpath.

      Thanks,
      Rakesh

      Comment


      • #4
        Hi All,

        Please help on this. I have checked my classpath. There are no older version jars in it.

        Regards,
        Rakesh

        Comment


        • #5
          It has to be a classpath problem - did you try the -verbose command line option like I suggested?

          If you still can't figure it out attach a FULL console log with DEBUG enabled for org.springframework as well as the -verbose option.

          Comment


          • #6
            Hi Gary,

            I tried the -verbose option and it is working fine when I am running it in eclipse it is loading the classes from the correct version jar of spring integration :

            Code:
            [Loaded org.springframework.context.support.PropertySourcesPlaceholderConfigurer from file:/home/rakesh/.m2/repository/org/springframework/spring-context/3.1.3.RELEASE/spring-context-3.1.3.RELEASE.jar]
            [Loaded org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler from file:/home/rakesh/.m2/repository/org/springframework/integration/spring-integration-core/2.2.0.RELEASE/spring-integration-core-2.2.0.RELEASE.jar]
            [Loaded org.springframework.integration.ip.config.IpNamespaceHandler from file:/home/rakesh/.m2/repository/org/springframework/integration/spring-integration-ip/2.2.0.RELEASE/spring-integration-ip-2.2.0.RELEASE.jar]
            [Loaded org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler$NamespaceHandlerDelegate from file:/home/rakesh/.m2/repository/org/springframework/integration/spring-integration-core/2.2.0.RELEASE/spring-integration-core-2.2.0.RELEASE.jar]

            But when I am exporting the project as a runnable jar, I can see the runnable jar itself from which the classes are getting loaded:

            Code:
            [Loaded org.springframework.core.env.ConfigurablePropertyResolver from file:/home/rakesh/Desktop/bda-producer.jar]
            [Loaded org.springframework.core.env.ConfigurableEnvironment from file:/home/rakesh/Desktop/bda-producer.jar]
            [Loaded org.springframework.beans.factory.config.AutowireCapableBeanFactory from file:/home/rakesh/Desktop/bda-producer.jar]
            [Loaded org.springframework.beans.factory.config.SingletonBeanRegistry from file:/home/rakesh/Desktop/bda-producer.jar]
            [Loaded org.springframework.beans.factory.config.ConfigurableBeanFactory from file:/home/rakesh/Desktop/bda-producer.jar]
            .
            .
            .
            .
            .
            [Loaded java.io.EOFException from /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/rt.jar]
            [Loaded org.springframework.core.NestedExceptionUtils from file:/home/rakesh/Desktop/bda-producer.jar]
            Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 47 in XML document from class path resource [resources/META-INF/spring/integration/tcpClientServerDemo-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 47; columnNumber: 37; cvc-complex-type.3.2.2: Attribute 'expression' is not allowed to appear in element 'int:transformer'.
            	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
            	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
            	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
            	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
            	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
            	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
            	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
            	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
            	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
            	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
            	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:530)
            	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:444)
            	at com.abc.bda.tcp.TelnetServer.performRole(TelnetServer.java:36)
            	at com.abc.bda.tcp.ZooElectableClient.determineAndPerformRole(ZooElectableClient.java:215)
            	at com.abc.bda.tcp.ZooElectableClient.run(ZooElectableClient.java:224)
            	at com.abc.bda_producer.App.main(App.java:40)
            Caused by: org.xml.sax.SAXParseException; lineNumber: 47; columnNumber: 37; cvc-complex-type.3.2.2: Attribute 'expression' is not allowed to appear in element 'int:transformer'.
            	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.processAttributes(XMLSchemaValidator.java:2663)
            	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2070)
            	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:729)
            	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353)
            	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)
            	... 15 more
            [Loaded java.util.IdentityHashMap$KeySet from /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/rt.jar]
            [Loaded java.util.IdentityHashMap$IdentityHashMapIterator from /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/rt.jar]
            [Loaded java.util.IdentityHashMap$KeyIterator from /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/rt.jar]
            [Loaded java.io.DeleteOnExitHook from /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/rt.jar]

            Please help. Thanks.

            Regards,
            Rakesh

            Comment


            • #7
              Ah... that explains everything. If you repackage Spring jars, you MUST include all the META-INF/spring-* files.

              This is the mechanism spring uses to find the correct schema at run time. When exporting to a runnable jar, you must select an option to maintain the integrity of the spring jars - do not select 'Extract required libraries...'. Otherwise you'll lose the spring metadata.

              Comment


              • #8
                Thanks a lot Gary. I have been banging my head since four days. It worked for me.

                Thanks and Regards,
                Rakesh

                Comment

                Working...
                X