Skip to main content

Problems On Running Embedded EJB In Weblogic

If you have ever test embedded EJB in Weblogic with JUnit, you probably have received exceptions like below:

Exception details:

java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at com.bea.xbean.validator.Validator.validateAtomicType(Validator.java:1323)
at com.bea.xbean.validator.Validator.validateSimpleType(Validator.java:1266)
at com.bea.xbean.validator.Validator.validateSimpleType(Validator.java:1202)
at com.bea.xbean.validator.Validator.handleText(Validator.java:829)
at com.bea.xbean.validator.Validator.textEvent(Validator.java:814)
at com.bea.xbean.validator.Validator.nextEvent(Validator.java:244)
at com.bea.xbean.validator.ValidatingXMLStreamReader.validate_event(ValidatingXMLStreamReader.java:656)
at com.bea.xbean.validator.ValidatingXMLStreamReader.next(ValidatingXMLStreamReader.java:546)

Solution:

You need set -XX:MaxPermSize=512m in VM arguments.

solution