[Geoserver-devel] [jira] Created: (GEOS-1493) startup faild with an old style config if the config directory is not writable

startup faild with an old style config if the config directory is not writable
------------------------------------------------------------------------------

                 Key: GEOS-1493
                 URL: http://jira.codehaus.org/browse/GEOS-1493
             Project: GeoServer
          Issue Type: Bug
          Components: Configuration
    Affects Versions: 1.6.0-beta4
            Reporter: Gabriel Roldán
            Assignee: Gabriel Roldán
            Priority: Critical
             Fix For: 1.6.0-RC1

If trying to load an old style config (i.e. no <log4jConfigFile> in settings.xml), startup fails with an error like the following:

On windows, tomcat service running as SYSTEM user, seems the error due to SYSTEM not having write access to config dir:
{code}
og4j:WARN Please initialize the log4j system properly.
10 Nov 08:44:55 ERROR [geoserver.global] -
----------------------------------
- GEOSERVER_DATA_DIR: C:\schemas\Projects\LandslidesPilot\geoserver_conf
----------------------------------
10 Nov 08:44:55 WARN [geoserver.global] - Your catalog.xml file is not up to date and is probably from an older version of GeoServer. This problem is now being fixed automatically.
10 Nov 08:44:56 WARN [geoserver.global] - No log4jConfigFile defined in services.xml: using 'DEFAULT_LOGGING.properties'
10 Nov 08:44:56 WARN [geoserver.global] - log4jConfigFile 'DEFAULT_LOGGING.properties' couldn't be found in the data dir, so GeoServer will install the various logging config file into the data dir, and then try to find it again.
10 Nov 08:44:56 WARN [geoserver.global] - Error trying to copy logging configuration file
java.io.FileNotFoundException: C:\schemas\Projects\LandslidesPilot\geoserver_conf\logs\DEFAULT_LOGGING.properties (The system cannot find the path specified)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at org.vfny.geoserver.global.GeoServer.copyResourceToFile(GeoServer.java:784)
        at org.vfny.geoserver.global.GeoServer.configureGeoServerLogging(GeoServer.java:657)
        at org.vfny.geoserver.global.GeoServer.load(GeoServer.java:479)
        at org.vfny.geoserver.global.GeoServer.<init>(GeoServer.java:133)
{code}

On linux, running {{mvn jetty:run}}, config dir set read only explicitly to verify the failure:
{code}
----------------------------------
- GEOSERVER_DATA_DIR: /home/gabriel/tmp/geos_data_cs
----------------------------------
09 Nov 22:44:08 ERROR [context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationState' defined in URL [file:/home/gabriel/svn/geoserver/1.6.x/geoserver/community/community-schemas/web-c/target/classes/applicationContext.xml]: Can't resolve reference to bean 'data' while setting property 'constructor argument'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'data' defined in URL [jar:file:/home/gabriel/.m2/repository/org/geoserver/main/1.6-beta4/main-1.6-beta4.jar!/applicationContext.xml]: Can't resolve reference to bean 'config' while setting property 'constructor argument'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in URL [jar:file:/home/gabriel/.m2/repository/org/geoserver/main/1.6-beta4/main-1.6-beta4.jar!/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'data' defined in URL [jar:file:/home/gabriel/.m2/repository/org/geoserver/main/1.6-beta4/main-1.6-beta4.jar!/applicationContext.xml]: Can't resolve reference to bean 'config' while setting property 'constructor argument'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in URL [jar:file:/home/gabriel/.m2/repository/org/geoserver/main/1.6-beta4/main-1.6-beta4.jar!/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in URL [jar:file:/home/gabriel/.m2/repository/org/geoserver/main/1.6-beta4/main-1.6-beta4.jar!/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException: null
java.lang.NullPointerException
        at java.io.FileInputStream.<init>(FileInputStream.java:103)
        at org.vfny.geoserver.global.xml.XMLConfigReader.loadServices(XMLConfigReader.java:241)
        at org.vfny.geoserver.global.xml.XMLConfigReader.load(XMLConfigReader.java:205)
        at org.vfny.geoserver.global.xml.XMLConfigReader.<init>(XMLConfigReader.java:169)
        at org.vfny.geoserver.global.Config.setApplicationContext(Config.java:75)
{code}

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira