ClassLoader Swapping Causing PermGen Issue
Hi Adobe,
We are trying to integrate CQ with CXF to consume webservices. As per recommendation by CQ from one of the posts, switching classloader makes the OSGI container aware of the class. We tried that option and were successful in integrating the webservice. But the classloader switching is causing a memory leak. With multiple deploys like around 5, the server is coming down. I am surprised that no one else faced this issue with classloader switching. Any help is greatly appreciated. Please see the code below,
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(BusFactory.class.getClassLoader()); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(new OsgiAwareClientFactoryBean()); factory.setServiceClass(pClass); factory.setAddress(pPortUrl); factory.setUsername(pUsername); factory.setPassword(pPassword); //This is where it blows up return (T) factory.create(); } Finally{ Switch back to the oldclass }