-
Notifications
You must be signed in to change notification settings - Fork 426
Group layers and tiling tab not loading due to faulty layers
When a user opens either the Layer Groups or the Tile Layers tabs (not a specific group or layer within those tabs) and get the following error message, the likely cause is from a faulty layer:
The difficulty at resolving this issue, is that the user cannot access the Group Layers or Tiling Layers tabs, making it impossible to use the Geoserver web interface to disable or remove layers which can be the possible cause. This section will deal with how a user can resolve such cases, and worked for cases before. Take note that this might not be the cause of the issue on your side, but these steps should still suffice as a good guide for anyone having issues.
If the Layers tab is still functional, it will be best for the user to disable each layer and also disable the layer's Tile Caching. Do the following:
- Click on the Layers tab;
- Select the layer you would like to disable;
- Uncheck the Enabled and Advertised boxes;
- Click on the Tile Caching tab for the layer; and
- Uncheck the Create a cached layer for this layer.
Doing this will remove the layer from the Geoserver Tile Caching. Best will be to remove one layer at a time to determine which layer is the cause. This may not solve the problem, but is the simpliest solution to get started with and there is also no need to completely remove the layer from Geoserver.
If your problem still persists (e.g. Group Layers and/or Tile Layers is still broken), or the above approach could not be applied, the user will need to go into the Geoserver files to fix the problem. This approach is much more difficult to apply, as it needs to be done using the console/terminal. NOTE: The user should also not completely delete or change files, and therefore backups are essential!
Do the following when accessing the docker console:
- Check if the container is running using "docker container ls". The response should include the geoserver docker container. Make note of the container name for later reference ('kartozageoserver_geoserver_1' in this case);
- Now the user can access the container console. Use the following command to accomplish this: "docker exec -it <container_name> bash";
- Simply use the "exit" command to go back to the host computer's console.
It's important to make a backup of the Geoserver prior to making manual changes, to avoid additional issues. Here is a quick guide on how this can be done:
- Open the docker console for the Geoserver container;
- Zip all of the contents of the Geoserver: "zip -r /tmp/geoserver.zip /opt/geoserver/data_dir". This will zip all of the contents of '/opt/geoserver/data_dir' into '/tmp/geoserver.zip';
- User the following command to copy the zip file to your local machine for save keeping and easy access: "docker cp :/tmp/geoserver.zip /directory/geoserver.zip"
- Open the docker console for the Geoserver container;
- Go to the Geoserver data directory: "cd /opt/geoserver/data_dir";
- Type "ls" to see all of the folder contants: The main folders we will be looking at is the layergroups and gwc-layers folders, depending on whether the issue is with groups or with tiling (or both). The layergroups folder contains an xml file for each group, whereas gwc-layers contains the xml file for each layer or group-layer which has tiling enabled. Ignore the gwc folder. Its also related to the tiling but not of interest now.
This section deals with group layers. Be sure to make a back of the Geoserver prior to doing this step (see above).
- Go into the group layers folder: "cd layergroups";
- List all of the contents: "ls". The user should receive a similar response to this (an empty list means that there are no group layers):
- As the user still has the Group Layers tab issue, and cannot remove a group from the Geoserver interface, they need to remove it here;
- To delete a group, do the following command: "rm ", where is the xml file of the group to be removed;
- As the user wants to determine which group layer is causing the issue, remove one layer at a time. Check in the Geoserver interface if the problem has been resolved;
A case like this has been traced back to a faulty layer which has been in use by one of the group layers, which broke the Group Layers tab - and therefore making it impossible to access or make changes to groups.
This section deals with a broken Tile Layers interface in Geoserver. As with Group Layers, the cause can be a faulty layer which has tiles generated.
- Go into the folder which containes the tiles for each group and layer: "cd gwc-layers";
- List all of the contents: "ls". The user should receive a similar response to this (an empty list means that there are no tile layers). The list would likely be large, this is because both group tiles and layer tiles are included:
- If the user has already disabled tiling for all of the layers, but there are still layer-related xml files, remove them using the following command: "rm ".
- If this did not resolve the problem, disable tile caching for all group layers;
- If the problem persists, remove each group-related xml file one at a time until the problem is resolved.
Removing a file which is not associated with a layer or group resolved the issue for another project, so this may be the cause of the Tile Layers issue - check if it resolved the issue;
Following the above instructions should have solved the problem if it were related to a faulty layer. The user now needs to reenable all layers, tiling and add all groups again, depending on the changes made to solve the problem.
- Renable all layers (set enabled and advertised to true);
- Enable Tile caching for each of the layers; and
- Keep testing the Tile layers to be sure the problem is not introduced again!
Adding all of the group layers again has a few steps to following, because the only available approach to the user will be to make use of the backuped xml files for the group layers.
- Firstly, try and directly copy one of the group layer xml files into the layersgroup folder. This can be done using the "docker cp" command;
- Check if the group layer shows in the Group Layers tab. This may work, but for some cases the user will need to manually add the group layer again;
If the above did not readd the group layer, the user will need to do it manually. This can be done opening the backuped xml file by using "cat ". The contents will consist of the group layers settings and layers. Here is an example, with the likely important parameters:
- Name: Group layer name;
- Title: Title of the group layer. If there is no title, use the Name; and
- Publishables: These will contain the IDs of layer and groups layers stored in this group layer.
Because the xml file only stores the ID of the layer or group layer, the user needs to make use of a workaround to determine which layer to use. This can be done as follows:
- Open the docker console;
- Go to the Geoserver data directory: "cd /opt/geoserver/data_dir";
- Do the following command: "grep -lr """ (e.g. "LayerInfoImpl-59885e9c:17723f2a5d8:-7ff8" for this example);
- The result should be similar to the following:
- The result from grep shows in which xml files this ID can be found, and, in this case, its the "MosselbayLandUnits" layer;
- The approach to do this for group layers is the same. Copy the group layer ID (e.g. "LayerGroupInfoImpl--3e9103c4:182ac7abea6:-3eb2") and perform a grep on it;
- The result should be similar to the following:
- There are two group layers in the result, but because we already know that "Asset Infrastructure" contains the group layer, the group layer is "Water_Network";
- Do this for each of the group layers.
Be sure to keep testing if the Tile Layers or Group Layers tabs causes any issues again while readding layers, groups and tiles for layers and groups. Its difficult to pin down the exact cause in such cases, especially if the Geoserver interface is broken with an error message providing no description of the cause. Using the console makes it more difficult, and deleting files is not something a user wants to do - so always be sure to make a backup of the Geoserver, as discussed above, before doing any of these steps.