views:

144

answers:

1

Hi there.

I'm running a tomcat-6 server on Gentoo. I'm having trouble deploying Nexus to my tomcat server (nexus-war from the sonatype website, and tomcat6 via emerge). The localhost log displays the following when Nexus is started:


May 31, 2010 6:50:52 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.sonatype.nexus.web.LogConfigListener
java.lang.IllegalStateException: Could not create default log4j.properties into /dev/null/sonatype-work/nexus/conf/log4j.properties
        at org.sonatype.nexus.web.LogConfigListener.ensureLogConfigLocation(LogConfigListener.java:130)
        at org.sonatype.nexus.web.LogConfigListener.contextInitialized(LogConfigListener.java:53)
        at org.apache.catalina.core.StandardContext.listenerStart(Unknown Source)
        at org.apache.catalina.core.StandardContext.start(Unknown Source)
        at org.apache.catalina.core.ContainerBase.addChildInternal(Unknown Source)
        at org.apache.catalina.core.ContainerBase.addChild(Unknown Source)
        at org.apache.catalina.core.StandardHost.addChild(Unknown Source)
        at org.apache.catalina.startup.HostConfig.deployWAR(Unknown Source)
        at org.apache.catalina.startup.HostConfig.deployWARs(Unknown Source)
        at org.apache.catalina.startup.HostConfig.deployApps(Unknown Source)
        at org.apache.catalina.startup.HostConfig.start(Unknown Source)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(Unknown Source)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Unknown Source)
        at org.apache.catalina.core.ContainerBase.start(Unknown Source)
        at org.apache.catalina.core.StandardHost.start(Unknown Source)
        at org.apache.catalina.core.ContainerBase.start(Unknown Source)
        at org.apache.catalina.core.StandardEngine.start(Unknown Source)
        at org.apache.catalina.core.StandardService.start(Unknown Source)
        at org.apache.catalina.core.StandardServer.start(Unknown Source)
        at org.apache.catalina.startup.Catalina.start(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.main(Unknown Source)
Caused by: java.io.FileNotFoundException: /dev/null/sonatype-work/nexus/conf/log4j.properties (Not a directory)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.(FileOutputStream.java:179)
        at java.io.FileOutputStream.(FileOutputStream.java:131)
        at org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1058)
        at org.codehaus.plexus.util.FileUtils.copyURLToFile(FileUtils.java:1018)
        at org.sonatype.nexus.web.LogConfigListener.ensureLogConfigLocation(LogConfigListener.java:126)
        ... 25 more

For some reason it looks for the sonatype-work folder in /dev/null. I have been unable to find a solution to this problem. The log4j.properties is located in /var/lib/tomcat-6/webapps/nexus-webapp-1.6.0/WEB-INF/log4j.properties and contain the following:

log4j.rootLogger=INFO, console
# CONSOLE
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.sonatype.nexus.log4j.ConcisePatternLayout
log4j.appender.console.layout.ConversionPattern=%4d{yyyy-MM-dd HH:mm:ss} %-5p - %c - %m%n

Has anyone had to deal with this before? Any help is greatly appreciated.

+1  A: 

This is a new one. In the war, the sonatype-work folder should default to ~/sonatype-work so if your environment has no user.home, this could cause what you see. You can try changing that default with an environment variable, see here for details. If you still have trouble, ping us on the nexus-user list for more immediate support.

Brian Fox
Hi there. You're right. The problem was that the tomcat user did not have a home folder assigned (the tomcat user is created automatically when emerging tomcat6). I updated /etc/passwd (the tomcat user previously had /dev/null set) and I am now able to deploy Nexus to Tomcat. :-)
John