PermGen space with jetty
java, jetty, maven, maven-3
Solution
Put this under the `<configuration>` element: `<jvmArgs>-XX:PermSize=256M -XX:MaxPermSize=512M</jvmArgs>`
So the Maven plugin will look like this:
<!-- To launch embded jetty server -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${maven-jetty-plugin.version}</version>
<configuration>
<jvmArgs>-XX:PermSize=256M -XX:MaxPermSize=512M</jvmArgs>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/${project.name}</contextPath>
<extraClasspath>target/classes;../services/target/classes;</extraClasspath>
</webAppConfig>
<scanTargets>
<scanTarget>target/classes</scanTarget>
<scanTarget>../services/target/classes</scanTarget>
</scanTargets>
</configuration>
</plugin>
NOTE: if it fails with a message that it can't allocate so much memory use lower numbers.
Problem
I'm developing a java web application where I'm using mavenlike tool of project managment. Now my trouble is that if i setted jetty for autoscan each 20 second in this way: ``` <!-- To launch embded jetty server --> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${maven-jetty-plugin.version}</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <webAppConfig> <contextPath>/${project.name}</contextPath> <extraClasspath>target/classes;../services/target/classes;</extraClasspath> </webAppConfig> <scanTargets> <scanTarget>target/classes</scanTarget> <scanTarget>../services/target/classes</scanTarget> </scanTargets> </configuration> </plugin> ``` Jetty starts in a correct way in fact i get: [INFO] Started Jetty Server [INFO] Starting scanner at interval of 20 seconds. But at the first scan i get the following error: ERROR ContextLoader - Context initialization failed java.lang.OutOfMemoryError: PermGen space How can I do to fix it? Update 1 I try to increse a PermGen space from my Eclipse Ide in this way: but after the first scan i get back the same error. How can I do to fix it?