0

I have GeoServer 2.17.1 installed as a WAR servlet in Tomcat 9. If the data files are located in

C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\data

everything works correctly. However, If the data files are located in

C:\Users\geoserveruser\Documents\GeoServerData

and the following context-param is added to

C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\WEB-INF\web.xml

<context-param>
   <param-name>GEOSERVER_DATA_DIR</param-name>
   <param-value>C:\Users\geoserveruser\Documents\GeoServerData</param-value>
</context-param> 

the data directory is not found. In fact a new directory is created in

C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\data

when Tomcat is restarted. The GeoServer documentation

https://docs.geoserver.org/stable/en/user/datadirectory/setting.html#web-archive

indicates this is the correct way to configure the GeoServer data directory and the context param is provided in web.xml and just needs to be uncommented and edited.

Why is this not working as indicated in the documentation?

UPDATE: Found these in the Tomcat log file

29 Jun 16:35:17 WARN [geoserver.platform] - Found Servlet context parameter GEOSERVER_DATA_DIR set to C:\Users\geoserveruser\Documents\GeoServerData , but this path does not exist

29 Jun 16:35:17 INFO [geoserver.platform] - Falling back to embedded data directory: C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\data

This explains why a new data directory is being created.

C:\Users\geoserveruser\Documents\GeoServerData

definitely exists and I verified the current (and all users) have read-write permissions for the directory.

Thoughts?

UPDATE: Attached are screenshots of the path in File Explorer and the security settings for the GeoServerData directory where there is Full Control. (note: this is a local dev environment so path is slightly different from question above, but equivalent).

enter image description here

enter image description here

1

This is because \ are not a very good character to use as a path separator in the Java world since they are used as the escape character. So if you must use a \ it is necessary to use two of them to escape the escapiness of them so your path becomes C:\\Users\\geoserveruser\\Documents\\GeoServerData but better and easier is to move into line with the rest of the computing world and use / as a path separator giving C:/Users/geoserveruser/Documents/GeoServerData.

To be honest if you are going to the trouble of installing Tomcat this is probably going to be a production machine in which case you should probably rethink the whole windows idea and use a proper operating system which doesn't need to use 50%+ of the CPU virus scanning on every request instead.

| improve this answer | |
  • Unfortunately, neither of these solutions solves the problem. The same error messages are displayed in the log file. The web.xml file that comes w/ the GeoServer WAR file has the context param which is commented out and it contains a single backslash character which indicates it should work. – ChrisP Jun 30 at 15:41
  • then the path probably doesn't exist for real – Ian Turton Jun 30 at 15:44
  • The path definitely exists as a previous installation of GeoServer has used this path for several years. The earlier non WAR installation used environment variables to specify the path whereas the new WAR installation under Tomcat uses the context param in web.xml. – ChrisP Jun 30 at 15:46
  • can you add a screen shot of explorer showing the directory? and properties tab showing GeoServer can write to it. Then turn logging up to devel and try again – Ian Turton Jun 30 at 15:51
  • Question edited w/ screenshots as requested – ChrisP Jun 30 at 16:14
0

After seeing Ian Turton's comment regarding directory permissions I compared permissions between

C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\geoserver\data

where GeoServer ran correctly with

C:\Users\chrispels\Documents\GeoServerData

the new location for the GeoServer data directory specified in web.xml and found that LOCAL SERVICE was not present. After adding LOCAL SERVICE with read/write permissons GeoServer was able to find and use the new data directory specified in web.xml correctly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.