Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexus Migration: Error updating database. Cause: org.h2.jdbc.JdbcSQLNonTransientException: The database is read only; SQL statement #545

Open
vaughnmb opened this issue Dec 23, 2024 · 0 comments
Assignees
Labels

Comments

@vaughnmb
Copy link

  • What problem are you trying to solve?
    After following the upgrade guide to produce the migration database from OrientDB to H2, I receive this error when the Docker container is booting up

Error updating database. Cause: org.h2.jdbc.JdbcSQLNonTransientException: The database is read only; SQL statement:

CREATE TABLE IF NOT EXISTS upgrade_tasks (
id INT GENERATED BY DEFAULT AS IDENTITY,
task_id varchar NOT NULL,
configuration JSON NOT NULL,
status varchar DEFAULT NULL,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
last_updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
) [90097-224]

The error may exist in org/sonatype/nexus/scheduling/internal/upgrade/datastore/UpgradeTaskDAO.xml

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: CREATE TABLE IF NOT EXISTS upgrade_tasks ( id INT GENERATED BY DEFAULT AS IDENTITY, task_id varchar NOT NULL, configuration JSON NOT NULL, status varchar DEFAULT NULL, created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, last_updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP );

Cause: org.h2.jdbc.JdbcSQLNonTransientException: The database is read only; SQL statement:

CREATE TABLE IF NOT EXISTS upgrade_tasks (
id INT GENERATED BY DEFAULT AS IDENTITY,
task_id varchar NOT NULL,
configuration JSON NOT NULL,
status varchar DEFAULT NULL,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
last_updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
) [90097-224]
at org.sonatype.nexus.datastore.mybatis.DataAccessSqlSession.unwrapMyBatisException(DataAccessSqlSession.java:125)
at org.sonatype.nexus.datastore.mybatis.DataAccessSqlSession.update(DataAccessSqlSession.java:86)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:141)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at com.sun.proxy.$Proxy159.createSchema(Unknown Source)
at org.sonatype.nexus.datastore.mybatis.MyBatisDataStore.register(MyBatisDataStore.java:281)
at org.sonatype.nexus.datastore.internal.DataStoreManagerImpl$DataAccessMediator.add(DataStoreManagerImpl.java:368)
at org.sonatype.nexus.datastore.internal.DataStoreManagerImpl$DataAccessMediator.add(DataStoreManagerImpl.java:1)
at org.eclipse.sisu.inject.WatchedBeans.add(WatchedBeans.java:80)
at org.eclipse.sisu.inject.InjectorBindings.publishExactMatches(InjectorBindings.java:157)
at org.eclipse.sisu.inject.InjectorBindings.subscribe(InjectorBindings.java:79)
at org.eclipse.sisu.inject.DefaultBeanLocator.watch(DefaultBeanLocator.java:80)
at org.sonatype.nexus.datastore.internal.DataStoreManagerImpl.doCreate(DataStoreManagerImpl.java:197)
at org.sonatype.nexus.datastore.internal.DataStoreManagerImpl.tryRestore(DataStoreManagerImpl.java:175)
at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422)
at org.sonatype.nexus.datastore.internal.DataStoreManagerImpl.doStart(DataStoreManagerImpl.java:124)
at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:69)
at org.sonatype.nexus.datastore.internal.DataStoreManagerImpl$$EnhancerByGuice$$71c2308.GUICE$TRAMPOLINE()
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)
at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
at org.sonatype.nexus.common.stateguard.StateGuard$TransitionImpl.run(StateGuard.java:206)
at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:57)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)
at org.sonatype.nexus.datastore.internal.DataStoreManagerImpl$$EnhancerByGuice$$71c2308.start()
at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:210)
at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:121)
at org.sonatype.nexus.extender.NexusContextListener.moveToPhase(NexusContextListener.java:334)
at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:231)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1597)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: The database is read only; SQL statement:
CREATE TABLE IF NOT EXISTS upgrade_tasks (
id INT GENERATED BY DEFAULT AS IDENTITY,
task_id varchar NOT NULL,
configuration JSON NOT NULL,
status varchar DEFAULT NULL,
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
last_updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
) [90097-224]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:566)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
at org.h2.message.DbException.get(DbException.java:223)
at org.h2.message.DbException.get(DbException.java:199)
at org.h2.message.DbException.get(DbException.java:188)
at org.h2.engine.Database.checkWritingAllowed(Database.java:1756)
at org.h2.engine.Database.addSchemaObject(Database.java:910)
at org.h2.table.Column.initializeSequence(Column.java:461)
at org.h2.command.ddl.CommandWithColumns.generateSequences(CommandWithColumns.java:103)
at org.h2.command.ddl.CreateTable.update(CreateTable.java:113)
at org.h2.command.CommandContainer.update(CommandContainer.java:169)
at org.h2.command.Command.executeUpdate(Command.java:256)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:265)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:48)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:75)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.sonatype.nexus.datastore.mybatis.EntityExecutor.update(EntityExecutor.java:74)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
at org.sonatype.nexus.datastore.mybatis.DataAccessSqlSession.update(DataAccessSqlSession.java:83)
... 32 common frames omitted

  • Do you have a workaround you are using at present?
    No

  • What feature or behavior is this required for?
    Migration from OrientDB to H2

  • How could we solve this issue? (Not knowing is okay!)

  • Tell us about your Nexus Repository deployment: what version, operating system, and database are you using?
    Currently running Nexus in Docker container for version: sonatype/nexus3:3.70.3-java11-alpine

  • Anything else?
    Migration tooled used: nexus-db-migrator-3.70.3-01.jar

Steps I took since I am running in Docker:

  1. Moved the nexus.mv.db inside the running Nexus container to the $data-dir/db
  2. Edited the $data-dir/etc/nexus.properties to add nexus.datastore.enabled=true
  3. Stopped the Nexus docker image: docker stop nexus
  4. Started the Nexus docker image: docker start nexus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants