• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Running junit test cases throws java.lang.OutOfMemoryError: PermGen space

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi All,

Running junit test cases throws java.lang.OutOfMemoryError: PermGen space, even fork=true is added to spawn new jvm for each test case, still junit fails with out of memory error,
i even used below vm arguments, still out of memory error. Thank you.

vmargs=-Xmx512M -Xms256m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:+UseOSErrorReporting

[junit] Tests run: 31, Failures: 0, Errors: 1, Time elapsed: 16.067 sec
[junit] Exception in thread "Thread-0" java.lang.OutOfMemoryError: PermGen s
pace
[junit] at java.lang.ClassLoader.defineClass1(Native Method)
[junit] at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
[junit] at java.security.SecureClassLoader.defineClass(SecureClassLoader
.java:142)
[junit] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[junit] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[junit] at java.security.AccessController.doPrivileged(Native Method)
[junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[junit] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

[junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[junit] at org.jacoco.agent.rt.internal_d8bef4a.output.FileOutput.writeE
xecutionData(FileOutput.java:55)
[junit] at org.jacoco.agent.rt.internal_d8bef4a.Agent.shutdown(Agent.jav
a:143)
[junit] at org.jacoco.agent.rt.internal_d8bef4a.Agent$1.run(Agent.java:6
0)
[junit] at org.jacoco.agent.rt.internal_d8bef4a.output.FileOutput.writeE
xecutionData(FileOutput.java:55)




Regards
Raj
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the size of your code base? Permgen space is meant for loading all your classes that comprises your application.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe,

After adding below code in Junit test cases, there is no out of memory :permgen but classloader violation errors are shown

@PowerMockIgnore( {"javax.management.*","org.apache.log4j.*"})


error message="loader constraint violation: when resolving method "org.apache.log4j.LogManager.getLogger(Ljava/lang/Class;)Lorg/apache/log4j/Logger;" the class loader (instance of org/powermock/core/classloader/MockClassLoader) of the current class, com/test/server/log/lookup/demoLookup, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, org/apache/log4j/LogManager, have different Class objects for the type ger.getLogger(Ljava/lang/Class;)Lorg/apache/log4j/Logger; used in the signature" type="java.lang.LinkageError"

i ran ant with -verbose to find which jars has same class getting loaded twice, log trace messages are not clear. any idea?

Is there any tool to find which jar file is getting loaded with same log4j class again?.


Regards
Raj
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic