While deploying an environment called "Interim" which is pretty much like a testing Java application deployed from a Java EAR (Enterprise Archive) file from within a Tomcat Manager GUI web interface after stopping the application and trying to start it, the developers come across the error:
FAIL – Application at context path /application-name could not be started
The error puzzled me for a while until I checked the catalina.out I've seen a number of thrown Java Eceptions errors like:
Okt 01, 2015 10:48:46 AM org.springframework.web.context.ContextLoader initWebApplicationContext
Schwerwiegend: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.sun.xml.ws.transport.http.servlet.SpringBinding#2' defined in ServletContex
t resource [/WEB-INF/pp-server-beans.xml]: Cannot create inner bean ‘(inner bean)’ of type [org.jvnet.jax_ws_commons.spring.SpringService] while setting bean property
'service'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#33': FactoryBean threw exception on
object creation; nested exception is java.lang.OutOfMemoryError: PermGen space
I've googled a bit about the error:
"FAIL – Application at context path /application-name could not be started"
and come across this Stackoverflow thread and followed suggested solution to fix web.xml tag closing error but it seems there was no such error in my case, I then also tried solution suggested by this thread (e.g. adding in logging.properties) file:
org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler
unfortunately this helped neither to solve the error when it is tried to be started from tomcat manager.
After asking for help a colleague Kostadin, he pointed me to take a closer look in the error (which is a clear indication) that the reserved space is not enough (see below err):
java.lang.OutOfMemoryError: PermGen space
And he pointed me then to Solution (which is to modify the present tomcat setenv.sh) settings which looked like this:
# Heap size settings
export JAVA_OPTS="-Xms2048M -Xmx2048M"
# SSCO test page parameter
export JAVA_OPTS="$JAVA_OPTS -DTS1A_TESTSEITE_CONFIG_PATH=test-myapplication.com"
# Default garbage collector settings
export JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=128M"
# Aggressive garbage collector settings.
# Do not use! For testing purposes only!
#export JAVA_OPTS="$JAVA_OPTS -Xss128k -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 -XX:+AggressiveOpts -XX:MaxPermSize=128M"
####### DO NOT CHANGE BELOW HERE #######
# Disable X11 usage
export JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
# Garbage collection log settings
export JAVA_OPTS="$JAVA_OPTS -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:/web/tomcat/current/logs/gc.log -XX:-TraceClassUnloading"
# Enable JMX console
export JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
The solution is to to add following two options to export JAVA_OPTS (above options):
After modifications, my new line within setenv.sh looked like so:
JAVA_OPTS="-Xms2048M -Xmx2048M -XX:PermSize=512m -XX:MaxPermSize=512m"
Finally to make new JAVA_OPTS settings, I've restarted Tomcat with:
sleep 5; ./startup.sh
And hooray it works fine thanks God! 🙂
More helpful Articles
Tags: apache, core, exception, logs, name, org, solution, sun, tomcat, web, xml
Mozilla/5.0 (Windows NT 6.1; rv:48.0) Gecko/20100101 Firefox/48.0
thanks for you are blog,
i followed u steps and did as u have told in it but one time i was make the application run.
but again i came into same problem .
can u help me what should i do to resole itView CommentView Comment
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 OPR/37.0.2178.54
Maybe you edited it but in the war file it is wrongly deployed, so you need to rebuild the war file to fix it and set proper configs.
GeorgiView CommentView Comment