geonetwork / geonetwork/core-geonetwork
Error in database migration from 3.4.5 to 3.6.0
- Dominant language
- Java
- Stars
- 521
- Forks
- 514
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 19
Description
**Describe the bug**
When deploying GN 3.6.0 with an old database from 3.4.x branch there is an exception that makes the migration fail
**Log file**
```
2019-01-23 11:10:06,817 WARN [geonetwork.databasemigration] - No migration task found between webapp and database version.
The system may be unstable or may failed to start if you try to run
the current GeoNetwork 3.6.1-SNAPSHOT with an older database (ie. 3.4.5
). Try to run the migration task manually on the current database
before starting the application or start with a new empty database.
Sample SQL scripts for migration could be found in WEB-INF/sql/migrate folder.
2019-01-23 11:10:24,874 ERROR [geonetwork.databasemigration] - Errors occurs during Java migration file: java.lang.ClassCastException: com.fasterxml.jackson.databind.node.MissingNode cannot be cast to com.fasterxml.jackson.databind.node.ObjectNode
2019-01-23 11:10:24,950 WARN [geonetwork.databasemigration] - Error occurs during migration. Check the log file for more details.
```
**Additional context**
The only two places where the cast to `ObjectNode` is done are:
https://github.com/geonetwork/core-geonetwork/blob/8f5d93ed43be441bdbfdb5e43eae0547ec01f64d/core/src/main/java/org/fao/geonet/migration/JsonDatabaseMigration.java#L113-L120
and
https://github.com/geonetwork/core-geonetwork/blob/8f5d93ed43be441bdbfdb5e43eae0547ec01f64d/core/src/main/java/org/fao/geonet/migration/JsonDatabaseMigration.java#L90-L110
Contributor guide
Research direction
Start in core/src/main/java/org/fao/geonet/migration/JsonDatabaseMigration.java, especially the two ObjectNode casts around lines 90-120, and reproduce migration from a 3.4.x database to GeoNetwork 3.6.0 using the logged failure as the guide. Done means the migration completes without the MissingNode-to-ObjectNode ClassCastException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100