geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
412 stars 487 forks source link

Metadata editor is not working #4556

Open dispiste opened 4 years ago

dispiste commented 4 years ago

Describe the bug When I try to edit any metadata record in the metadata editor, I get an HTTP 400 error while loading geonetwork/srv/api/records/68690/editor?&currTab=default&starteditingsession=yes&_random=xxxx and the metadata editor never loads (only the top bar is displayed).

This problem happens in 2 different servers (having the same exact environment). However, it works correctly in my local Tomcat installation. We have not modified Geonetwork code.

I have seen some relevant errors in the log, related with the wro4j cache, but I have deleted the cache and the problem persists.

To Reproduce Steps to reproduce the behavior:

  1. Open any metadata record
  2. Click on edit

Expected behavior The metadata editor should be loaded, but it is not correctly loaded

Log file (extract)

2020-03-25 23:12:32,348 ERROR [geonetwork.wro4j] - Error occurred during a wro4j request handling
ro.isdc.wro.WroRuntimeException: No such group available in the model: _custom_style
...
2020-03-27 12:43:26,330 ERROR [ro.isdc.wro.http.WroFilter] - Exception occured
ro.isdc.wro.WroRuntimeException: Cannot build valid CacheKey from request: /geonetwork/static/bootstrap-tagsinput.min.js.map
...
2020-03-27 12:57:48,175 ERROR [geonetwork.wro4j] - Error occurred during a wro4j request handling
ro.isdc.wro.WroRuntimeException: Cannot build valid CacheKey from request: /geonetwork/static/none

Environment:

Additional context I have also traced this "_custom_style" log entry in Geonetwork souce code. I found:

xslt/base-layout-cssjs-loader.xsl:
  <link href="{/root/gui/url}/static/{/root/gui/nodeId}_custom_style.css?v={$buildNumber}&amp;{$minimizedParam}"
      rel="stylesheet" media="screen"/>

WEB-INF/config-spring-geonetwork.xml:
  <value>srv_custom_style.css</value>

So probably the error is related with {/root/gui/nodeId} variable not being properly initialized. I see the following Java classes are related with nodeId:

dispiste commented 4 years ago

I attach a snapshot to illustrate the problem:

Captura de pantalla de 2020-03-27 19-23-47

dispiste commented 4 years ago

Hi, I've finally found the cause of the problem. This deployment was updated from version 3.6.x to 3.10.1. We use an external data directory and the 3.10.1 version provides updated metadata schemas which were not automatically copied to the external data directory. This was causing the errors.

I am not sure if it is an expected behaviour or if it should be considered a bug. As the metadata schemas are automatically copied to the data folder on the initial execution, I would expect they are copied again when they change. However, I can also see some good reasons to overwrite the existing schemas in the data dir.

juanluisrp commented 4 years ago

That's how it works. If the schema exists in the data directory it is not automatically copied there again. If you want to use the latest changes you can customize the schema plugins directory and point it to the folder included inside webapps/geonetwork using the property geonetwork.schema.dir. For example: -Dgeonetwork.schema.dir=/app/tomcat/webapps/geonetwork/WEB-INF/data/config/schema_plugins