You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by SRIKANT MVS <sr...@gmail.com> on 2021/05/02 06:33:55 UTC

Unable to set CXF CachedOutputStream.Threshold

Hi All,
I was able to fix this issue by passing the below parameters as system
properties to my camel springboot application.
-Dorg.apache.cxf.io.CachedOutputStream.Threshold=256000
-Dorg.apache.cxf.io.CachedOutputStream.OutputDirectory=/opt/application/logs

And I removed the <cxf:bus> xml tag from the spring-config.xml file.

-Regards
Srikant  Mantha

---------- Forwarded message ---------
From: SRIKANT MVS <sr...@gmail.com>
Date: Wed, Apr 28, 2021 at 7:18 PM
Subject: Unable to set CXF CachedOutputStream.Threshold
To: <us...@camel.apache.org>


Hi, I am using camel-cxf and have exposed soap service over HTTP using
cxfEndpoint. There are few requests that are getting logged into the /tmp
folder as the size is great than 64K-128K.
I want to increase the memory size greater than 128K so that the request
does not gets saved in the /tmp folder.



Below is my spring-config.xml where I am creating the camel-cxf bus object.
This is the default bus object when I verified after looking into the
source code of  io.apache.cxf.io.CachedOutputStream.java class.

<*bean **class*
="org.apache.camel.component.cxf.transport.CamelTransportFactory">
  <*property **name*="bus" *ref*="cxf" />
  <*property **name*="transportIds">
    <*list*>
      <*value*>http://cxf.apache.org/transports/camel</*value*>
    </*list*>
  </*property*>
  <*property **name*="checkException" *value*="true"></*property*>
</*bean*>



I am including the cxfEndpoints in my spring-config.xml file.

<*import **resource*="endpoints/TestEndpoint.xml" />



<*cxf**:cxfEndpoint **id*="cXFTestHttp"
  *address*="/TestService/TestServiceName"
  *loggingFeatureEnabled*="true" *endpointName*="a:***SOAPPort"
  *wsdlURL*="META-INF/wsdl/TestService/****.wsdl"
  *serviceName*="a:TestService"
  *serviceClass*="com.example.***"
  *xmlns:**a*="http://test***">
  <*cxf**:properties*>
    <*entry **key*="schema-validation-enabled"
*value*="${schema.validation.enabled}" />
    <!-- set to 1MB, The threshold value in bytes to switch from
memory to file caching -->
    <*entry **key*="org.apache.cxf.io.CachedOutputStream.Threshold"
*value*="256000"/>
    <!-- set to 100MB The data size in bytes to limit the maximum data
size to be cached -->
    <*entry **key*="org.apache.cxf.io.CachedOutputStream.MaxSize"
*value*="10000000"/>
    <!-- The directory name for storing the temporary files -->
    <*entry **key*="bus.io.CachedOutputStream.OutputDirectory" *value*="/tmp"/>
  </*cxf**:properties*>
  <*cxf**:inInterceptors*>
     <*ref **bean*="ecsLoggingInInterceptor" />
  </*cxf**:inInterceptors*>
  <*cxf**:outInterceptors*>
     <*ref **bean*="ecsLoggingOutInterceptor" />
  </*cxf**:outInterceptors*>
</*cxf**:cxfEndpoint*>



These properties are not getting picked up.



I also tried adding <cxf:bus> and its properties, but the xml throw
exception



<*cxf**:bus **id*="cxf">
  <*cxf**:properties*>
    <*entry **key*="org.apache.cxf.io.CachedOutputStream.Threshold"
*value*="256000" />
    <*entry **key*="org.apache.cxf.io.CachedOutputStream.OutputDirectory"
*value*="/tmp" />
  </*cxf**:properties*>
</*cxf**:bus*>



Caused by:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
70 in XML document from file [*****] is invalid;
nested exception is org.xml.sax.SAXParseException; lineNumber: 70;
columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict,
but no declaration can be found for element 'cxf:bus'.

                at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:402)
~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

                at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:338)
~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

                at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

                at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

                at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

                at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:255)
~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]

                ... 30 more

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The
matching wildcard is strict, but no declaration can be found for element
'cxf:bus'.



What am I missing here. Where should I add these properties effectively ?
Any help appreciated. I am using camel version 3.4.5 and cxf version is
3.3.6.



 -Regards

Srikant Mantha

Re: Unable to set CXF CachedOutputStream.Threshold

Posted by SRIKANT MVS <sr...@gmail.com>.
Hi Claus,
Yes, I found this information from the cxf documentation
https://cxf.apache.org/docs/security.html under the Large data stream
caching section.

-Regards
Srikant Mantha

On Sun, May 2, 2021 at 9:43 AM Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Thanks for sharing the solution for this problem.
>
> Did you find this information on a link to Apache CXF or someplace
> else? I ask because we could maybe add a section to the camel-cxf doc
> page talking about this and with a link to more details at Apache CXF.
>
> On Sun, May 2, 2021 at 8:34 AM SRIKANT MVS <sr...@gmail.com> wrote:
> >
> > Hi All,
> > I was able to fix this issue by passing the below parameters as system
> > properties to my camel springboot application.
> > -Dorg.apache.cxf.io.CachedOutputStream.Threshold=256000
> > -Dorg.apache.cxf.io
> .CachedOutputStream.OutputDirectory=/opt/application/logs
> >
> > And I removed the <cxf:bus> xml tag from the spring-config.xml file.
> >
> > -Regards
> > Srikant  Mantha
> >
> > ---------- Forwarded message ---------
> > From: SRIKANT MVS <sr...@gmail.com>
> > Date: Wed, Apr 28, 2021 at 7:18 PM
> > Subject: Unable to set CXF CachedOutputStream.Threshold
> > To: <us...@camel.apache.org>
> >
> >
> > Hi, I am using camel-cxf and have exposed soap service over HTTP using
> > cxfEndpoint. There are few requests that are getting logged into the /tmp
> > folder as the size is great than 64K-128K.
> > I want to increase the memory size greater than 128K so that the request
> > does not gets saved in the /tmp folder.
> >
> >
> >
> > Below is my spring-config.xml where I am creating the camel-cxf bus
> object.
> > This is the default bus object when I verified after looking into the
> > source code of  io.apache.cxf.io.CachedOutputStream.java class.
> >
> > <*bean **class*
> > ="org.apache.camel.component.cxf.transport.CamelTransportFactory">
> >   <*property **name*="bus" *ref*="cxf" />
> >   <*property **name*="transportIds">
> >     <*list*>
> >       <*value*>http://cxf.apache.org/transports/camel</*value*>
> >     </*list*>
> >   </*property*>
> >   <*property **name*="checkException" *value*="true"></*property*>
> > </*bean*>
> >
> >
> >
> > I am including the cxfEndpoints in my spring-config.xml file.
> >
> > <*import **resource*="endpoints/TestEndpoint.xml" />
> >
> >
> >
> > <*cxf**:cxfEndpoint **id*="cXFTestHttp"
> >   *address*="/TestService/TestServiceName"
> >   *loggingFeatureEnabled*="true" *endpointName*="a:***SOAPPort"
> >   *wsdlURL*="META-INF/wsdl/TestService/****.wsdl"
> >   *serviceName*="a:TestService"
> >   *serviceClass*="com.example.***"
> >   *xmlns:**a*="http://test***">
> >   <*cxf**:properties*>
> >     <*entry **key*="schema-validation-enabled"
> > *value*="${schema.validation.enabled}" />
> >     <!-- set to 1MB, The threshold value in bytes to switch from
> > memory to file caching -->
> >     <*entry **key*="org.apache.cxf.io.CachedOutputStream.Threshold"
> > *value*="256000"/>
> >     <!-- set to 100MB The data size in bytes to limit the maximum data
> > size to be cached -->
> >     <*entry **key*="org.apache.cxf.io.CachedOutputStream.MaxSize"
> > *value*="10000000"/>
> >     <!-- The directory name for storing the temporary files -->
> >     <*entry **key*="bus.io.CachedOutputStream.OutputDirectory"
> *value*="/tmp"/>
> >   </*cxf**:properties*>
> >   <*cxf**:inInterceptors*>
> >      <*ref **bean*="ecsLoggingInInterceptor" />
> >   </*cxf**:inInterceptors*>
> >   <*cxf**:outInterceptors*>
> >      <*ref **bean*="ecsLoggingOutInterceptor" />
> >   </*cxf**:outInterceptors*>
> > </*cxf**:cxfEndpoint*>
> >
> >
> >
> > These properties are not getting picked up.
> >
> >
> >
> > I also tried adding <cxf:bus> and its properties, but the xml throw
> > exception
> >
> >
> >
> > <*cxf**:bus **id*="cxf">
> >   <*cxf**:properties*>
> >     <*entry **key*="org.apache.cxf.io.CachedOutputStream.Threshold"
> > *value*="256000" />
> >     <*entry **key*="org.apache.cxf.io
> .CachedOutputStream.OutputDirectory"
> > *value*="/tmp" />
> >   </*cxf**:properties*>
> > </*cxf**:bus*>
> >
> >
> >
> > Caused by:
> > org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
> Line
> > 70 in XML document from file [*****] is invalid;
> > nested exception is org.xml.sax.SAXParseException; lineNumber: 70;
> > columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is
> strict,
> > but no declaration can be found for element 'cxf:bus'.
> >
> >                 at
> >
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:402)
> > ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
> >
> >                 at
> >
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:338)
> > ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
> >
> >                 at
> >
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
> > ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
> >
> >                 at
> >
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
> > ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
> >
> >                 at
> >
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
> > ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
> >
> >                 at
> >
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:255)
> > ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
> >
> >                 ... 30 more
> >
> > Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The
> > matching wildcard is strict, but no declaration can be found for element
> > 'cxf:bus'.
> >
> >
> >
> > What am I missing here. Where should I add these properties effectively ?
> > Any help appreciated. I am using camel version 3.4.5 and cxf version is
> > 3.3.6.
> >
> >
> >
> >  -Regards
> >
> > Srikant Mantha
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Re: Unable to set CXF CachedOutputStream.Threshold

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Thanks for sharing the solution for this problem.

Did you find this information on a link to Apache CXF or someplace
else? I ask because we could maybe add a section to the camel-cxf doc
page talking about this and with a link to more details at Apache CXF.

On Sun, May 2, 2021 at 8:34 AM SRIKANT MVS <sr...@gmail.com> wrote:
>
> Hi All,
> I was able to fix this issue by passing the below parameters as system
> properties to my camel springboot application.
> -Dorg.apache.cxf.io.CachedOutputStream.Threshold=256000
> -Dorg.apache.cxf.io.CachedOutputStream.OutputDirectory=/opt/application/logs
>
> And I removed the <cxf:bus> xml tag from the spring-config.xml file.
>
> -Regards
> Srikant  Mantha
>
> ---------- Forwarded message ---------
> From: SRIKANT MVS <sr...@gmail.com>
> Date: Wed, Apr 28, 2021 at 7:18 PM
> Subject: Unable to set CXF CachedOutputStream.Threshold
> To: <us...@camel.apache.org>
>
>
> Hi, I am using camel-cxf and have exposed soap service over HTTP using
> cxfEndpoint. There are few requests that are getting logged into the /tmp
> folder as the size is great than 64K-128K.
> I want to increase the memory size greater than 128K so that the request
> does not gets saved in the /tmp folder.
>
>
>
> Below is my spring-config.xml where I am creating the camel-cxf bus object.
> This is the default bus object when I verified after looking into the
> source code of  io.apache.cxf.io.CachedOutputStream.java class.
>
> <*bean **class*
> ="org.apache.camel.component.cxf.transport.CamelTransportFactory">
>   <*property **name*="bus" *ref*="cxf" />
>   <*property **name*="transportIds">
>     <*list*>
>       <*value*>http://cxf.apache.org/transports/camel</*value*>
>     </*list*>
>   </*property*>
>   <*property **name*="checkException" *value*="true"></*property*>
> </*bean*>
>
>
>
> I am including the cxfEndpoints in my spring-config.xml file.
>
> <*import **resource*="endpoints/TestEndpoint.xml" />
>
>
>
> <*cxf**:cxfEndpoint **id*="cXFTestHttp"
>   *address*="/TestService/TestServiceName"
>   *loggingFeatureEnabled*="true" *endpointName*="a:***SOAPPort"
>   *wsdlURL*="META-INF/wsdl/TestService/****.wsdl"
>   *serviceName*="a:TestService"
>   *serviceClass*="com.example.***"
>   *xmlns:**a*="http://test***">
>   <*cxf**:properties*>
>     <*entry **key*="schema-validation-enabled"
> *value*="${schema.validation.enabled}" />
>     <!-- set to 1MB, The threshold value in bytes to switch from
> memory to file caching -->
>     <*entry **key*="org.apache.cxf.io.CachedOutputStream.Threshold"
> *value*="256000"/>
>     <!-- set to 100MB The data size in bytes to limit the maximum data
> size to be cached -->
>     <*entry **key*="org.apache.cxf.io.CachedOutputStream.MaxSize"
> *value*="10000000"/>
>     <!-- The directory name for storing the temporary files -->
>     <*entry **key*="bus.io.CachedOutputStream.OutputDirectory" *value*="/tmp"/>
>   </*cxf**:properties*>
>   <*cxf**:inInterceptors*>
>      <*ref **bean*="ecsLoggingInInterceptor" />
>   </*cxf**:inInterceptors*>
>   <*cxf**:outInterceptors*>
>      <*ref **bean*="ecsLoggingOutInterceptor" />
>   </*cxf**:outInterceptors*>
> </*cxf**:cxfEndpoint*>
>
>
>
> These properties are not getting picked up.
>
>
>
> I also tried adding <cxf:bus> and its properties, but the xml throw
> exception
>
>
>
> <*cxf**:bus **id*="cxf">
>   <*cxf**:properties*>
>     <*entry **key*="org.apache.cxf.io.CachedOutputStream.Threshold"
> *value*="256000" />
>     <*entry **key*="org.apache.cxf.io.CachedOutputStream.OutputDirectory"
> *value*="/tmp" />
>   </*cxf**:properties*>
> </*cxf**:bus*>
>
>
>
> Caused by:
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
> 70 in XML document from file [*****] is invalid;
> nested exception is org.xml.sax.SAXParseException; lineNumber: 70;
> columnNumber: 21; cvc-complex-type.2.4.c: The matching wildcard is strict,
> but no declaration can be found for element 'cxf:bus'.
>
>                 at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:402)
> ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
>
>                 at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:338)
> ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
>
>                 at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
> ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
>
>                 at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
> ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
>
>                 at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
> ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
>
>                 at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:255)
> ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
>
>                 ... 30 more
>
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The
> matching wildcard is strict, but no declaration can be found for element
> 'cxf:bus'.
>
>
>
> What am I missing here. Where should I add these properties effectively ?
> Any help appreciated. I am using camel version 3.4.5 and cxf version is
> 3.3.6.
>
>
>
>  -Regards
>
> Srikant Mantha



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2