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?

8
  • 4
    increase the perm size not the heap size Commented Dec 11, 2013 at 8:53
  • 1
    How? google.co.in/#q=permgen+space+eclipse Tried alll the result from this. I dont knowhow to solve this. Commented Dec 11, 2013 at 8:53
  • Where can I increase it? in Code? or in JAVA properties or in Jetty distribution? Everyone simply sugesting to increase permgen but how? Commented Dec 11, 2013 at 8:55
  • This should help stackoverflow.com/questions/3003855/increase-permgen-space Commented Dec 11, 2013 at 8:56
  • I'm wondering, where can I type this ? -XX:MaxPermSize=128m Commented Dec 11, 2013 at 8:57

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

2 Comments

Wow.. This worked great. I have to set the size first and then call the jar. Thank you so much.
plus one for Run Configurations info
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)

4 Comments

I'm using embedded jetty server. It looks like standalone server.
how do you run it? via maven?
No using the link I've given above in my question
then you need to increase the sizes of you're whole application. how do you run your application? via jar? via commandline? via eclipse?
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.

9 Comments

Hendrik, I'm not Re-deploying, I have 50 war files. I'm trying to depoly it in jetty server. At deploy itself, geting this error. I cant deploy after 38th war files.
The javaw process in task manager reaches 205MB and it got this problem.
So either start your eclipse with this -XX:MaxPermSize option, or add it to the VM arguments of your run configuration for the embedded jetty server in eclipse.
In Run configuration I went to (x)=Arguments tab and wrote -XX:MaxPermSize=1024m still no change. Is the variable name wrong?
-XX... aren't program arguments, but VM-arguments. Perhaps stackoverflow.com/questions/862391/… helps you.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.