Tuesday, October 6, 2009

Unable to create the home directory '/dev/null/.hudson'


Problem :


You deploy hudson.war in Tomcat 6 and when you want to show hudson main page, you have
this error :
Unable to create the home directory '/dev/null/.hudson'. This is most likely a permission problem.

To change the home directory, use HUDSON_HOME environment variable or set the
HUDSON_HOME system property. See Container-specific documentation for more details of how to do this.


Solution :


- Create a home directory for Hudson.


mkdir -p /home/hudson

chown -R tomcat:tomcat /home/hudson/


ls -al /home/hudson/

drwxr-xr-x 6 tomcat tomcat 4096 Oct 3 18:45 hudson


Note : I've notice that you must restart Tomcat for that's work.


- Add the HUDSON home directory for Tomcat in the tomcat startup script :


vi /etc/init.d/tomcat-6


Search JAVA_OPTS

Then add some line after :


JAVA_OPTS="$JAVA_OPTS -DHUDSON_HOME=/home/hudson"


Example :

...

# Activate Logging

if [ -r "${CATALINA_HOME}"/bin/tomcat-juli.jar ]; then

JAVA_OPTS="${JAVA_OPTS} -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \

-Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties"

fi

JAVA_OPTS="$JAVA_OPTS -DHUDSON_HOME=/home/hudson"

...


- Modify the Tomcat user file (
vi /etc/tomcat-6/tomcat-users.xml )
cf AdministrationHudson

- Then Restart Tomcat.

1 comment: