cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Schmitz-Hennemann <oli9...@googlemail.com>
Subject REST web service loading many classes for each request CXF 2.2.6 and jaxb-impl 2.1.5
Date Fri, 06 Aug 2010 10:02:04 GMT
Hi Everybody,

we have implemented a REST webservice using CXF 2.2.6 and jaxb 2.1.5 running
in a tomcat 6.0.10.
We are experiencing some serious problems concerning perm gen memory usage
induced by continuously loading classes.
Having traced around through the code we now know that the problem is
induced by the fact, that the JaxbContext and within that some Injector
implementations are only stored in WeakReferences. This each GC removes
both. So, each Request after a GC will create a lot of classes.
Looking at the AbstractJAXBProvider in org.apache.cxf.jaxrs.provider, it
seams possible to supply an JAXB Context somehow, but I could not figure
out, how to do that.


   protected JAXBContext getJAXBContext(Class<?> type, Type genericType)
throws JAXBException {
        if (mc != null) {
            ContextResolver<JAXBContext> resolver =
                mc.getResolver(ContextResolver.class, JAXBContext.class);
            if (resolver != null) {
                JAXBContext customContext = resolver.getContext(type);
                if (customContext != null) {
                    return customContext;
                }
            }
        }


Anybody any idea if this  is the rigth solution, and how to make use of it?

Oli

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message