The Spring WebApplicationContext could not be started
Symptoms
Stash does not start and the following message can be seen in the logs:
May 10, 2012 11:41:28 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
...
On the web browser the following is displayed:
http://localhost:7990/fatal.jsp
A fatal error has occurred
The following problem occurred which prevents Atlassian Stash from starting correctly:
The Spring WebApplicationContext could not be started
Cause
This is a generic message that the application cannot be started and the root causes are varied which often require further investigation of the Stash logs. If, after eliminating the possible causes below the application still fails to start, please create a support issue at https://support.atlassian.com and zip and attach to the issue the following directories:
<Stash installation directory>/logs
$STASH_HOME/log
- Start Stash in foreground and attach the output:
<Stash installation directory>/bin/start-stash.sh -fg
There are five possible causes:
- A trailing slash ( \ ) in the end of the
STASH_HOME
environment variable. This was fixed in the Stash 1.0.4 release: - STASH-2520Getting issue details... STATUS - The hostname you are using must be resolvable (try
ping $HOSTNAME
). E.g. The hostnamelocalhost
has not been added to/etc/hosts
. Refer to Stash Fails to Start Up with java.net.UnknownHostException Exception - The
JAVA_HOME
variable is not configured. - Stash Does Not Start - Unable to clean the cache directory .
- Stash fails to start - The Spring WebApplicationContext could not be started - Unresolved constraint in bundle
- If your server does not have enough free physical RAM to allocate to the JVM for Stash.
Resolution
Regarding the first three possible causes mentioned above there are three resolutions:
Even though this issue has been fixed, instead of:
STASH_HOME=C:\Trial\atlassian-stash-1.0.1\
it should be (no trailing slash in the end):
STASH_HOME=C:\Trial\atlassian-stash-1.0.1
Add the name of the Stash server in
/etc/hosts
associating it to 127.0.0.1 and restart Stash. The entry in/etc/hosts
should resemble the following:127.0.0.1 hostname
Create a
JAVA_HOME
variable for the user who is running Stash:JAVA_HOME=/PATH/TO/THE/JAVA/ROOT/DIRECTORY