Posts tagged jboss
I have been using Jboss As 6 a lot lately and it seems that with the new edition of application server from JBoss, it quite often runs into PermGen space issue. To rectify the problem each time, i had to bring down the development server only to bring it up again. It becomes quite haphazard and tedious especially with a slower machine.
A search on Google found some great articles, but the comments left behind by this particular user nailed it (Raghav http://blog.yannis-lionis.gr/?p=8). There were even some silly suggestions like switching to JRockit. Well ignore those.
PermGen space out of memory error when redeploying a JSF 2.0 web application through Maven Cargo plugin
To minimize this, one has to effectively “optimize” the JVM settings which JBoss runs on.
Step 1: Locate and open up run.conf
run.conf is usually found in the bin folder of your application server.
Location of my run.conf file
It is recommended that you modify the settings of the JVM through this file, and not through the .bat itself unless you have specific requirements.
Sample run.conf file
Step 2: Locate and change out the settings below the line that says “rem # JVM memory allocation pool parameters”
rem # JVM memory allocation pool parameters set ...(deleted for simplicity)
Change it to:
rem # JVM memory allocation pool parameters set "JAVA_OPTS=-Xms680m -Xmx680m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled"
You now need only to restart your server to see the effects.
bash-3.2$ Calling C:\c\server\jbossas-vms\jboss-6.0.0.Final\bin\run.conf.bat =============================================================================== JBoss Bootstrap Environment JBOSS_HOME: C:\c\server\jbossas-vms\jboss-6.0.0.Final JAVA: C:\Program Files\Java\jdk1.6.0_22\bin\java JAVA_OPTS: -Dprogram.name=run.bat -Xms680m -Xmx680m -XX:PermSize=245m -XX:MaxPermSize=1024m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg.jboss.resolver.warning=true -server CLASSPATH: C:\Program Files\Java\jdk1.6.0_22\lib\tools.jar;C:\c\server\jbossas-vms\jboss-6.0.0.Final\bin\run.jar ===============================================================================
Notice that JBoss AS echoes my new settings on start up.
My PM (@Work) notes and shares that, in Microsoft Windows 32 bit environment, you would not be able to set a value higher than 1024 for your JVM in most cases. Look at this forum thread for some discussion on it http://www.minecraftforum.net/viewtopic.php?f=10&t=167193. Can someone elaborate some on this please? =p
You might have possibly configured all requests to go to struts.xml from your web.xml.
However when doing a http://localhost/ , you hit the error:
There is no Action mapped for namespace / and action name
This is because Struts 2 is unable to find the action name, which is none, under the namespace / .
If you are using Struts2 over JBoss AS, you need to do three things.
Descend to your server deploy root in search of the file “ROOT.WAR”, ROOT.WAR is what you see when you hit http://localhost:8080/ or http://localhost/ or http://myDomainName depending on how you have configured your listening port.
Search and delete the file “ROOT.WAR”.
You may find ROOT.WAR in three or four folders under /server, the server profile that you are usually using should be “default”, so descend into default, delete the file ROOT.WAR.
ROOT.WAR is usually found in
In Linux, you may issue the following command to find ROOT.WAR
$ find / -name “ROOT.WAR” -print
Preferred method (Because it is not always the case you are deploying your .WAR as a standalone, it may be part of a .EAR enterprise archive)
In web application that you are trying to fix as the root application, under/WEB-INF folder, create the file “jboss-web.xml” if you do not already have one.
Enter this into jboss-web.xml:
The file should be placed under /WEB-INF/jboss-web.xml . It would be of interest to anyone that contents placed under /WEB-INF is protected from public direct access.
Non preferred method (Quick and easy)
Rename the web application that you are trying to fix as the root application to “ROOT.WAR” from whatever name it was given or using.
In struts.xml, insert the code snippet. you should change out your redirect action and namespace accordingly. For this, i have requested redirection to the initLogin action of the secure namespace. Theoretically, the same action may be accessed by http://localhost/mywebapp/secure/initLogin.
Redeploy to take effect. If you have turned off hot deploy, you may need to restart the server to take effect!