Friday, October 12, 2012

Liferay JRebel PermGen IntelliJ Idea

Problem:
  1. IntelliJ use JAVA_OPTS for setting -XX:MaxPermSize in Run/Debug Configurations
  2. catalina.sh overwrites JAVA_OPTS with CATALINA_OPTS
  3. Liferay+Tomcat bundle defines
    CATALINA_OPTS as "... -Xmx1024m -XX:MaxPermSize=256m"
  4. => settings in the IDE are overwritten by the bundle default configuration :(

Result:
/usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.config.file=/opt/liferay.git/bundles/tomcat-7.0.27/conf/logging.properties -javaagent:/home/topolik/.IntelliJIdea11/config/plugins/jr-ide-idea/lib/jrebel/jrebel.jar -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:52374,suspend=y,server=n -javaagent:/opt/idea-IU-117.117/plugins/Groovy/lib/agent/gragent.jar -Xms512m -Xmx1024m -XX:MaxPermSize=512m -Dfile.encoding=UTF8 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m -Djava.endorsed.dirs=/opt/liferay.git/bundles/tomcat-7.0.27/endorsed -classpath /opt/liferay.git/bundles/tomcat-7.0.27/bin/bootstrap.jar:/opt/liferay.git/bundles/tomcat-7.0.27/bin/tomcat-juli.jar -Dcatalina.base=/opt/liferay.git/bundles/tomcat-7.0.27 -Dcatalina.home=/opt/liferay.git/bundles/tomcat-7.0.27 -Djava.io.tmpdir=/opt/liferay.git/bundles/tomcat-7.0.27/temp org.apache.catalina.startup.Bootstrap start


Workaround:
Hack one of Tomcat's env. properties to include the MaxPermSize settings AFTER CATALINA_OPTS:
  1. In the IntelliJ Run/Debug configurations dialog add a new env. variable named CATALINA_TMPDIR with the following value (don't forget the quotes!):
    $CATALINA_BASE/temp" -XX:MaxPermSize=512m -Dwhatever="
Note: If you are running Windows, use %CATALINA_BASE%/temp instead of $CATALINA_BASE/temp in the variable value

Result:

/usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.config.file=/opt/liferay.git/bundles/tomcat-7.0.27/conf/logging.properties -javaagent:/home/topolik/.IntelliJIdea11/config/plugins/jr-ide-idea/lib/jrebel/jrebel.jar -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:52374,suspend=y,server=n -javaagent:/opt/idea-IU-117.117/plugins/Groovy/lib/agent/gragent.jar -Xms512m -Xmx1024m -XX:MaxPermSize=724m -Dfile.encoding=UTF8 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m -Djava.endorsed.dirs=/opt/liferay.git/bundles/tomcat-7.0.27/endorsed -classpath /opt/liferay.git/bundles/tomcat-7.0.27/bin/bootstrap.jar:/opt/liferay.git/bundles/tomcat-7.0.27/bin/tomcat-juli.jar -Dcatalina.base=/opt/liferay.git/bundles/tomcat-7.0.27 -Dcatalina.home=/opt/liferay.git/bundles/tomcat-7.0.27 -Djava.io.tmpdir=/opt/liferay.git/bundles/tomcat-7.0.27/temp -XX:MaxPermSize=512m -Dwhatever= org.apache.catalina.startup.Bootstrap start


No comments:

Post a Comment