[ 
https://issues.apache.org/jira/browse/CXF-1647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15512275#comment-15512275
 ] 

S V Mohana Rao edited comment on CXF-1647 at 9/22/16 5:55 AM:
--------------------------------------------------------------

[~alexhopgood] This can be achieved by below configuration. Convension over 
configuration.

<bean id="wsPayloadLogFeature" class="org.apache.cxf.feature.LoggingFeature" >
        <property name="limit" value="${cxf.payload.limit}" />
</bean>

<cxf:bus>
        <cxf:features>
                <ref bean="wsPayloadLogFeature" />
        </cxf:features>
</cxf:bus>


was (Author: mohanaraosv):
This can be achieved by below configuration. Convension over configuration.

<bean id="wsPayloadLogFeature" class="org.apache.cxf.feature.LoggingFeature" >
        <property name="limit" value="${cxf.payload.limit}" />
</bean>

<cxf:bus>
        <cxf:features>
                <ref bean="wsPayloadLogFeature" />
        </cxf:features>
</cxf:bus>

> Non-String Placeholders Fail to Validate
> ----------------------------------------
>
>                 Key: CXF-1647
>                 URL: https://issues.apache.org/jira/browse/CXF-1647
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.1
>         Environment: JDK 1.5.0_13, Mule 2.0, Spring framework 2.5.4
>            Reporter: Eugene Goldfarb
>            Assignee: Daniel Kulp
>            Priority: Minor
>             Fix For: 2.2.5
>
>
> Using the schema-based spring bean configuration doesn't work with some 
> property placeholders which are required to be integers.
> The timeout properties are declared as <xsd:integer> in the XSD, making the 
> configuration fail.
> The MULE project had this issue as well, they handled it by introducing a 
> special replaceable types in their schema.
> See http://mule.mulesource.org/jira/browse/MULE-1887
> I'm not using CXF's configuration reader or servlet. I am loading the beans 
> via mule2 by including the application-context.xml file in mule-config.xml. 
> It uses Spring for configuration.  
> <mule xmlns="http://www.mulesource.org/schema/mule/core/2.0";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:spring="http://www.springframework.org/schema/beans";
>       xsi:schemaLocation="
>                 http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>                 http://www.mulesource.org/schema/mule/core/2.0 
> http://www.mulesource.org/schema/mule/core/2.0/mule.xsd";>
>       <spring:beans>
>               <spring:import resource="/application-context.xml"/>
>       </spring:beans>
> </mule>
> Spring application-context.xml:
> <?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:aop="http://www.springframework.org/schema/aop";
>       xmlns:tx="http://www.springframework.org/schema/tx";
>       xmlns:context="http://www.springframework.org/schema/context";
>       xmlns:http="http://cxf.apache.org/transports/http/configuration";
>       xsi:schemaLocation="http://www.springframework.org/schema/beans
>               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>         http://www.springframework.org/schema/context 
> http://www.springframework.org/schema/context/spring-context-2.5.xsd
>               http://www.springframework.org/schema/tx 
> http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
>         http://www.springframework.org/schema/aop 
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 
>         http://cxf.apache.org/transports/http/configuration 
> http://cxf.apache.org/schemas/configuration/http-conf.xsd";>
>       <context:property-placeholder location="classpath:billing.properties" />
> <!-- ...Configure a CXF-based client here ...-->
>       <http:conduit name="*.http-conduit">
>               <http:client ConnectionTimeout="${httpTimeout}"
>                       ReceiveTimeout="${httpTimeout}" MaxRetransmits="1"
>                       AutoRedirect="true" Connection="Keep-Alive" />
>       </http:conduit>
> </beans>
> Error:
> 4620 [main] ERROR org.mule.config.builders.AbstractConfigurationBuilder  - 
> Configuration with "org.mule.config.spring.SpringXmlConfigurationBuilder" 
> failed.
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 
> Configuration problem: Failed to import bean definitions from relative 
> location [/application-context.xml]
> Offending resource: URL [file:/C:/dev/mule/target/classes/mule-config.xml]; 
> nested exception is 
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 
> 158 in XML document from URL 
> [file:/C:/dev/mule/target/classes/application-context.xml] is invalid; nested 
> exception is org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: 
> '${httpTimeout}' is not a valid value for 'integer'.
>       at 
> org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
>       at 
> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
>       at 
> org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
>       at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:201)
>       at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
>       at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
>       at 
> org.mule.config.spring.MuleBeanDefinitionDocumentReader.parseBeanDefinitions(MuleBeanDefinitionDocumentReader.java:45)
>       at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>       at 
> org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.handleSpringElements(MuleHierarchicalBeanDefinitionParserDelegate.java:162)
>       at 
> org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.parseCustomElement(MuleHierarchicalBeanDefinitionParserDelegate.java:70)
>       at 
> org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.parseCustomElement(MuleHierarchicalBeanDefinitionParserDelegate.java:130)
>       at 
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1243)
>       at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:141)
>       at 
> org.mule.config.spring.MuleBeanDefinitionDocumentReader.parseBeanDefinitions(MuleBeanDefinitionDocumentReader.java:45)
>       at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>       at 
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
>       at 
> org.mule.config.spring.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:216)
>       at 
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
>       at 
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
>       at 
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
>       at 
> org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:102)
>       at 
> org.mule.config.spring.MuleApplicationContext.<init>(MuleApplicationContext.java:56)
>       at 
> org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringParentRegistry(SpringXmlConfigurationBuilder.java:95)
>       at 
> org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:71)
>       at 
> org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:38)
>       at 
> org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
>       at 
> org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:97)
>       at 
> org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:55)
>       at com.defimobile.mule.TestNewCustomer.init(TestNewCustomer.java:27)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at 
> org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49)
>       at 
> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36)
>       at 
> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
>       at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
>       at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: 
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 
> 158 in XML document from URL 
> [file:/C:/dev/mule/target/classes/application-context.xml] is invalid; nested 
> exception is org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: 
> '${httpTimeout}' is not a valid value for 'integer'.
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>       at 
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:190)
>       ... 42 more
> Caused by: org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: 
> '${httpTimeout}' is not a valid value for 'integer'.
>       at 
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
>       at 
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
>       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.processOneAttribute(XMLSchemaValidator.java:2799)
>       at 
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2735)
>       at 
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2094)
>       at 
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:725)
>       at 
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:322)
>       at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
>       at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>       at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>       at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>       at 
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>       at 
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)
>       at 
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
>       at 
> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
>       at 
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
>       ... 45 more



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to