You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After migrating the database from OrientDB to H2 on Nexus 3.70.2, on the first start, Nexus logged the following error
2024-09-04 11:04:25,360+0000 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.datastore.mybatis.MyBatisDataStore - nexus - Creating schema for Maven2AssetBlobDAO
2024-09-04 11:05:13,829+0000 WARN [FelixStartLevel] *SYSTEM Sisu - Problem adding: org.eclipse.sisu.inject.LazyBeanEntry@158af590 to org.sonatype.nexus.datastore.mybatis
.MyBatisDataStore$$EnhancerByGuice$$14b8c6a6@42745891 via org.sonatype.nexus.datastore.internal.DataStoreManagerImpl$DataAccessMediator@494874d6
org.sonatype.nexus.datastore.api.DataAccessException:
### Error updating database. Cause: org.h2.jdbc.JdbcSQLNonTransientException: General error: "org.h2.mvstore.MVStoreException: Chunk 44722 not found [2.2.224/9]"; SQL statement:
--
-- each format has an asset blob table which they can extend
--
CREATE TABLE IF NOT EXISTS maven2_asset_blob (
asset_blob_id INT GENERATED BY DEFAULT AS IDENTITY,
blob_ref VARCHAR NOT NULL,
blob_size BIGINT NOT NULL,
content_type VARCHAR NOT NULL,
checksums JSON NOT NULL,
blob_created TIMESTAMP WITH TIME ZONE NOT NULL,
created_by VARCHAR,
created_by_ip VARCHAR,
CONSTRAINT pk_maven2_asset_blob_id PRIMARY KEY (asset_blob_id),
CONSTRAINT uk_maven2_asset_blob_ref UNIQUE (blob_ref)
) [50000-224]
### The error may exist in org.sonatype.nexus.content.maven.store.Maven2AssetBlobDAO
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: -- -- each format has an asset blob table which they can extend -- CREATE TABLE IF NOT EXISTS maven2_asset_blob ( asset_blob_id INT GENERATED BY DEFAULT AS IDENTITY, blob_ref VARCHAR NOT NULL, blob_size BIGINT NOT NULL, content_type VARCHAR NOT NULL, checksums JSON NOT NULL, blob_created TIMESTAMP WITH TIME ZONE NOT NULL, created_by VARCHAR, created_by_ip VARCHAR, CONSTRAINT pk_maven2_asset_blob_id PRIMARY KEY (asset_blob_id), CONSTRAINT uk_maven2_asset_blob_ref UNIQUE (blob_ref) ); ALTER TABLE maven2_asset_blob ADD COLUMN IF NOT EXISTS added_to_repository TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP; CREATE INDEX IF NOT EXISTS idx_maven2_asset_blob_added_to_repository ON maven2_asset_blob (added_to_repository); CREATE INDEX IF NOT EXISTS idx_maven2_asset_blob_created ON maven2_asset_blob (blob_created); --
To test if a new h2database fixes the error in Nexus I've made a Docker image with Nexus 3.70.2 and h2database 2.3.232 using the following Dockerfile:
FROM sonatype/nexus3:3.70.2-java11-ubi
ENV NEXUS_FULL_VERSION=3.70.2-01
ENV OLD_H2_VERSION=2.2.224
ENV H2_VERSION=2.3.232
USER root
RUN rm -rf /opt/sonatype/nexus/system/com/h2database/h2/${OLD_H2_VERSION}
RUN curl --create-dirs -o /opt/sonatype/nexus/system/com/h2database/h2/${H2_VERSION}/h2-${H2_VERSION}.jar https://repo1.maven.org/maven2/com/h2database/h2/${H2_VERSION}/h2-${H2_VERSION}.jar
RUN sed -e "s=<bundle>mvn:com.h2database/h2/${OLD_H2_VERSION}</bundle>=<bundle>mvn:com.h2database/h2/${H2_VERSION}</bundle>=" -i /opt/sonatype/nexus/system/org/sonatype/nexus/assemblies/nexus-base-feature/${NEXUS_FULL_VERSION}/nexus-base-feature-${NEXUS_FULL_VERSION}-features.xml
RUN sed -e "s=<bundle>mvn:com.h2database/h2/${OLD_H2_VERSION}</bundle>=<bundle>mvn:com.h2database/h2/${H2_VERSION}</bundle>=" -i /opt/sonatype/nexus/system/com/sonatype/nexus/assemblies/nexus-flags-feature/${NEXUS_FULL_VERSION}/nexus-flags-feature-${NEXUS_FULL_VERSION}-features.xml
RUN sed -e "s=<bundle>mvn:com.h2database/h2/${OLD_H2_VERSION}</bundle>=<bundle>mvn:com.h2database/h2/${H2_VERSION}</bundle>=" -i /opt/sonatype/nexus/system/org/sonatype/nexus/nexus-datastore-mybatis/${NEXUS_FULL_VERSION}/nexus-datastore-mybatis-${NEXUS_FULL_VERSION}-features.xml
USER nexus
The above modification was enough to start Nexus successfully.
For context, our Maven repositories on that Nexus instance have around 1.7 million components and 12 million assets.
The text was updated successfully, but these errors were encountered:
After migrating the database from OrientDB to H2 on Nexus 3.70.2, on the first start, Nexus logged the following error
After this error, Nexus shut down itself.
A quick Internet search led me to h2database/h2database#4012, with the fix in version 2.3.230.
To test if a new h2database fixes the error in Nexus I've made a Docker image with Nexus 3.70.2 and h2database 2.3.232 using the following Dockerfile:
The above modification was enough to start Nexus successfully.
For context, our Maven repositories on that Nexus instance have around 1.7 million components and 12 million assets.
The text was updated successfully, but these errors were encountered: