My Oracle Support Banner

PermGen OOM Error Occurs on Redeploying Application Involving OpenJPA (Doc ID 1530911.1)

Last updated on AUGUST 30, 2021

Applies to:

Oracle WebLogic Server - Version 10.3.5 and later
Information in this document applies to any platform.


On : 10.3.5 version, When repeating redeploy application, PermGen OOM Error occurs.

The issue can be reproduced at will with the following steps:

1. Build and deploy ejb30 example application.
cd <WLS_HOME>\wlserver_10.3\samples\server\examples\src\examples\ejb\ejb30
ant build
ant deploy

2 Redeploy application several times until OOM Error.
Using following command to redeploy ear:
java weblogic.Deployer -adminurl t3://<HOST>:<PORT> -user weblogic -password <password> -redeploy -name reviewService -source <WLS_HOME>\wlserver_10.3\samples\server\examples\build\ejb30\reviewService.ear

During the testing, open jvisualvm to monitor permgen space usage. Every time application redeployed, click Perform GC, then click Heap Dump to acquire heap dump file.

3 Analyze heap dump using MAT(eclipse memory analyzer)
Heap dump analysis shows that OpenJPA class PCRegistry has a member variable "_meta", a type of ConcurrentReferenceHashMap, which references persist-able bean class. But it has no opportunity to remove elements from the HashMap on application undeployed. Within test case heap dump, a classloader sun.misc.Launcher$AppClassLoader @ 0xeff00a8 loaded class org.apache.openjpa.enhance.PCRegistry @ 0x25be61b8. PCRegistry object has a member variable "_meta", it is type of  ConcurrentReferenceHashMap, which keeps entry of type org.apache.openjpa.enhance.PCRegistry$Meta. org.apache.openjpa.enhance.PCRegistry$Meta has a field "fieldTypes", which is type of Class[]. The class array has a member reference to class examples.ejb.ejb30.domain.Item @ 0x28f9b758,  which is loaded by  weblogic.utils.classloaders.GenericClassLoader @ 0x10a089f0 . Because org.apache.openjpa.enhance.PCRegistry is referenced by sun.misc.Launcher$AppClassLoader and will never be unloaded even when application undeploy,  the reference to  examples.ejb.ejb30.domain.Item @ 0x28f9b758 does not be released, so does its associated class loader weblogic.utils.classloaders.GenericClassLoader @ 0x10a089f0 .


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.