1

I am trying to deploy multiple application in a jetty server. Currently I have 50 applications and I'm following the answer from this jetty server 9.1 multiple embeded ports and application in same server instance.

I'm getting java.lang.OutOfMemoryError: PermGen space at the 38th deployment. How do I solve this?

Community
  • 1
  • 1
Pasupathi Rajamanickam
  • 1,982
  • 1
  • 24
  • 48

3 Answers3

11

Any memory control options are part of the JVM that you start for your embedded Jetty application. That means, in order for you to increase the PermGen that the JVM uses, you'll need to use the command line option -XX:MaxPermSize against the JVM when you start your embedded Jetty instance.

Example:

$ java -XX:MaxPermSize=1024m -cp myserver.jar com.company.EmbeddedMe

Since you added the tag, I'll assume you want to know how to configure your "Run Configuration" for this same thing.

In Run > Run Configurations > Arguments Tab > VM Arguments, put -XX:MaxPermSize=1024m

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
1

Increase the perm and heap size of your jetty instance

http://pic.dhe.ibm.com/infocenter/chghelp/v5m3/topic/com.ibm.rational.change.install.doc/topics/ch_t_ig_change_java_max_heap_jty.html

when you run it via commandline:

java -jar -XX:MaxPermSize=512m jety.jar 

if this doesn't work, increase the size (e.g. 1024m)

Pasupathi Rajamanickam
  • 1,982
  • 1
  • 24
  • 48
Philipp Sander
  • 10,139
  • 6
  • 45
  • 78
0

Deploying generates a bunch of Class objects which are allocated in the permanent space and never really garbage collected.

To solve this, you might want to increase the size of the permanent space with the JVM option -XX:MaxPermSize=128m (see here for more JVM options/descriptions).

Note that starting with Java8, perm space has been removed. So as an alternative you could also upgrade your JDK to Java8.

Hendrik
  • 5,085
  • 24
  • 56