You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by glopezm <gm...@gmail.com> on 2010/11/09 12:50:39 UTC

Re: Performance Issue: Axis2's JAXBUtils recreating a JAXBContext on each call.

I'm experiencing similar problems with the same axis version. I'm wondering
what have you exactly done and how to get this improvement. Could you please
elaborate for me and let me know any new findings about the issue?

Thanks in advance!


Victor Rentea wrote:
> 
> Hello everyone!
> 
> I'm using IBM Websphere with Axis2 1.5.1, and I ran into a performance
> problem: a request to an JAXWS endpoint took approx 1000 ms to
> complete. After investigating, I found out that the problem is in the
> JAXBContext: it did not managed to cache the JAXBContexts
> successfully.
> 
> I used debugging tools and found out that in the map that cached
> JAXBContexts there was a strange value for the classloader associated
> with my cached JAXBContext (i.e.: a DeploymentClassLoader).
> 
> With every request that came, the JAXBUtils had to create another
> JAXBContext because the "current" classloader of the request was
> something like "CompoundClassLoader" (i think it was IBM-specific) did
> not match the "DeploymentClassLoader" there.
> 
> I must say that I also tried the JAXWS samples in the Axis2 distrib
> and those worked fine. I started aligning my code to that of the
> sample, but the error still reproduces after I made the two almost
> identical.
> 
> 
> Can you give me some idea of the cause?
> 
> 
> I managed to work around this problem by registering an axis2 handler
> that explicitly set
> 
> Parameter p = new
> Parameter(Constants.CACHE_CLASSLOADER,this.getClass().getClassLoader());
> messageContext.getAxisService().removeParameter(p);
> messageContext.getAxisService().addParameter(p);
> 
> Now the time is down to approx 50ms, and the JaxbContext is cached OK.
> 
> Is my approach corect?
> 
> Thank you!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Performance-Issue%3A-Axis2%27s-JAXBUtils-recreating-a-JAXBContext-on-each--call.-tp27983202p30170036.html
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: Performance Issue: Axis2's JAXBUtils recreating a JAXBContext on each call.

Posted by glopezm <gm...@gmail.com>.
I've managed myself to get the response and I'd like to share it with the
community in case someone else reach the same problem. I couldn't get to
know why this "hack" actualy fix the performance problem but anyways it
works and sounds reasonable. The symptoms in my case were almost the same as
what Victor described. In order to implement this change, you just have to
create an Axis2 handler extending from
org.apache.axis2.handlers.AbstractHandler and implementing the invoke
method, adding the code lines that Victor mentioned. After that, this
handler must be configured within an existing or new phase within the
axis2.xml configuration file. 

Hope this helps!


glopezm wrote:
> 
> I'm experiencing similar problems with the same axis version. I'm
> wondering what have you exactly done and how to get this improvement.
> Could you please elaborate for me and let me know any new findings about
> the issue?
> 
> Thanks in advance!
> 
> 
> Victor Rentea wrote:
>> 
>> Hello everyone!
>> 
>> I'm using IBM Websphere with Axis2 1.5.1, and I ran into a performance
>> problem: a request to an JAXWS endpoint took approx 1000 ms to
>> complete. After investigating, I found out that the problem is in the
>> JAXBContext: it did not managed to cache the JAXBContexts
>> successfully.
>> 
>> I used debugging tools and found out that in the map that cached
>> JAXBContexts there was a strange value for the classloader associated
>> with my cached JAXBContext (i.e.: a DeploymentClassLoader).
>> 
>> With every request that came, the JAXBUtils had to create another
>> JAXBContext because the "current" classloader of the request was
>> something like "CompoundClassLoader" (i think it was IBM-specific) did
>> not match the "DeploymentClassLoader" there.
>> 
>> I must say that I also tried the JAXWS samples in the Axis2 distrib
>> and those worked fine. I started aligning my code to that of the
>> sample, but the error still reproduces after I made the two almost
>> identical.
>> 
>> 
>> Can you give me some idea of the cause?
>> 
>> 
>> I managed to work around this problem by registering an axis2 handler
>> that explicitly set
>> 
>> Parameter p = new
>> Parameter(Constants.CACHE_CLASSLOADER,this.getClass().getClassLoader());
>> messageContext.getAxisService().removeParameter(p);
>> messageContext.getAxisService().addParameter(p);
>> 
>> Now the time is down to approx 50ms, and the JaxbContext is cached OK.
>> 
>> Is my approach corect?
>> 
>> Thank you!
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Performance-Issue%3A-Axis2%27s-JAXBUtils-recreating-a-JAXBContext-on-each--call.-tp27983202p30189208.html
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org