cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Avner Levy <>
Subject RE: Reuse JAXB context in jaxws
Date Wed, 03 Oct 2012 07:31:55 GMT
Thanks for the quick answer.
I've added the following to my spring configuration:

<bean class="org.apache.cxf.jaxb.JAXBDataBinding" >
    <constructor-arg index="0" value="#{GlobalContextBean.context}"/>

And the start-up time of the application / memory was significantly changed (for good).
Am I supposed to add something more or this should be enough?
How should I configure the CXF endpoints to use it? (although it looks like they already did)
Thanks in advance,

-----Original Message-----
From: Daniel Kulp [] 
Sent: Tuesday, October 02, 2012 11:02 PM
Subject: Re: Reuse JAXB context in jaxws

On Oct 2, 2012, at 8:16 AM, Avner Levy <> wrote:
> Hi,
> I have multiple services which can return results out of thousands of classes. 
> Since each CXF service contains a private otherwise-identical JAXB context, it causes
a huge memory waste. 
> Is there a way to create the JAXB context myself and share it between the services?
> Thanks in advance,
> Avner

The JAXBDataBinding does have a constructor that takes a JAXBContext.   Thus, you could create
the JAXBDataBinding object yourself with the JAXBContext you need, then configure that into
the CXF endpoints.   There is a <jaxws:dataBinding> child element for the <jaxws:endpoint>
if you are using that to setup the services.

That said, I HIGHLY doubt this is well tested.  You'd be in more or less uncharted territory.

Daniel Kulp - Talend Community Coder -

Scanned by Check Point Total Security Gateway.

View raw message