Hello Team,
I had following issue in h2 while performing db recovery with h2. I have shared the details below.
Environment:
Nexus Version: 3.70.1
H2 Version: 2.2.224
Java Version: 11
Deployment: OpenShift (Pod with PVC mounted)
Steps Performed for H2 DB Recovery
-
Scaled down Nexus pod and opened a debug container.
-
Ran H2 Recover tool:
Shelljava -cp /sonatype/nexus/system/com/h2database/h2/2.2.224/h2-2.2.224.jar \org.h2.tools.Recover -dir /nexus-data/db -db nexusShow more lines
→ Generated files: /nexus-data/db/nexus.h2.sql and nexus.h2.log. -
Renamed broken DB:
Shellmv /nexus-data/db/nexus.mv.db /nexus-data/db/nexus.mv.db.brokenShow more lines -
Ran H2 RunScript to rebuild DB:
Shelljava -cp /sonatype/nexus/system/com/h2database/h2/2.2.224/h2-2.2.224.jar \org.h2.tools.RunScript -url “jdbc:h2:/nexus-data/db/nexus” -user as -password “” -script /nexus-data/db/nexus.h2.sqlShow more lines -
Scaled Nexus pod back up.
Issue Observed
On startup, Nexus fails with:
… 48 common frames omitted
2025-12-08 11:15:09,079+0100 ERROR [FelixStartLevel] *SYSTEM org.sonatype.nexus.extender.NexusContextListener - Failed to start nexus
org.sonatype.nexus.datastore.api.DataAccessException:
Error querying database. Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column ‘ROLES’ from result set. Cause: java.sql.SQLException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.util.HashSet<java.lang.Object> from String value (token JsonToken.VALUE_STRING)
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 1]
The error may exist in org/sonatype/nexus/internal/security/model/CUserRoleMappingDAO.xml
The error may involve org.sonatype.nexus.internal.security.model.CUserRoleMappingDAO.read
The error occurred while handling results
SQL: SELECT * FROM user_role_mapping WHERE user_id = ? AND source = ?;
Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column ‘ROLES’ from result set. Cause: java.sql.SQLException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.util.HashSet<java.lang.Object> from String value (token JsonToken.VALUE_STRING)
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 1]
at org.sonatype.nexus.datastore.mybatis.DataAccessSqlSession.unwrapMyBatisException(DataAccessSqlSession.java:125)
at org.sonatype.nexus.datastore.mybatis.DataAccessSqlSession.selectList(DataAccessSqlSession.java:76)
Expected Outcome
Nexus should start successfully after H2 recovery.
Actual Outcome
Startup fails.
Questions for Support
Is this error caused by data corruption during recovery?
Is there an official Sonatype-supported procedure for H2 DB recovery in Nexus 3.70.1?
Thanks for your continuous support.