# Nexus 3.70.1-02 with H2 Database

**URL:** <https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681>\
**Category:** Sonatype Nexus Repository\
**Tags:** nexus-repository\
**Created:** [March 25, 2025, 9:17am UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681 "2025-03-25T09:17:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sameer29nov](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sameer29nov](https://community.sonatype.com/u/sameer29nov)\
**Post date:** [March 25, 2025, 9:17am UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/1 "2025-03-25T09:17:12Z")

</div>

Hello there,

We want to use Nexus version 3.70.1-02 with the H2 database as the default DB. However, when we try to install it, it always starts with OrientDB.

We know that version 3.70.1-02 supports both databases, and we need to make some changes in the `nexus.properties` file. After trying several tweaks, we are still unsure where to add `nexus.datastore.enabled=true` — in `nexus.properties` or `nexus-default.properties` — so that Nexus 3.70.1-02 starts with H2 by default, not with OrientDB.

The requirement is that we can use a preconfigured `nexus.properties` file, ensuring that Nexus 3.70.1-02 starts with H2 as the default, not with OrientDB.

Can someone help here?

Regards,  
SAM

---

<div class="post-metadata">

**Author:** ![laurencet](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/laurencet/32/3456_2.png) [@laurencet](https://community.sonatype.com/u/laurencet)\
**Post date:** [March 25, 2025, 11:17am UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/2 "2025-03-25T11:17:05Z")

</div>

For a brand new deployment (no sonatype-work directory) you will have to create the path and file: `/opt/<nexus directory>/sonatype-work/nexus3/etc/nexus.properties` - in this file add the line ‘`nexus.datastore.enabled=true`’ and then start the application. This will start Nexus with the H2 database.

It is likely you were adding this in to nexus.properties found in the application directory such as `/opt/<nexus directory>/nexus-3.70.1-02/etc` which will not work.

If you have an existing deployment you would need to also run a DB migration to move the data from Orient to H2.

[https://help.sonatype.com/en/migrating-to-a-new-database.html#migrating-from-orientdb-to-h2-162010](https://help.sonatype.com/en/migrating-to-a-new-database.html#migrating-from-orientdb-to-h2-162010)

---

<div class="post-metadata">

**Author:** ![sameer29nov](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sameer29nov](https://community.sonatype.com/u/sameer29nov)\
**Post date:** [March 25, 2025, 11:39am UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/3 "2025-03-25T11:39:54Z")

</div>

@laurencet

Thank you for your response. Apologies if I misinterpreted your explanation; please correct me if I’m wrong. Since we are using Nexus as a container, do we need to do something like this?

1. Create the directory `/opt/<nexus directory>/sonatype-work/nexus3/etc/`
2. Add the preconfigured `nexus.properties` in the above path.
3. Then, start the Nexus services.

Regards,  
SAM

---

<div class="post-metadata">

**Author:** ![laurencet](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/laurencet/32/3456_2.png) [@laurencet](https://community.sonatype.com/u/laurencet)\
**Post date:** [March 25, 2025, 11:49am UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/4 "2025-03-25T11:49:35Z")

</div>

Hey Sam,

Since you’re running in a container it may be easier to just pass this as an enviroment variable. Depending on your method (docker run or docker compose) you could achieve this with the following:

Docker run:

```auto
-e INSTALL4J_ADD_VM_PARAMS="-Dnexus.datastore.enabled"

```

Docker compose:

```auto
environment:
      - INSTALL4J_ADD_VM_PARAMS=-Dnexus.datastore.enabled

```

Hope this helps

---

<div class="post-metadata">

**Author:** ![sameer29nov](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sameer29nov](https://community.sonatype.com/u/sameer29nov)\
**Post date:** [March 26, 2025, 4:23am UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/5 "2025-03-26T04:23:03Z")

</div>

Hello @laurencet

I tried the suggestions you asked me to test:

- I added `ENV INSTALL4J_ADD_VM_PARAMS=-Dnexus.datastore.enabled` in the Dockerfile.
- I also added the same environment variable in the Compose file.

( **Note: I didn’t created path and preconfigured nexus.properties file you mentioned in your first answer in this case** )

However, in both cases, I am encountering the following errors:

> 2025-03-26 05:08:42,174+0100 INFO [jetty-main-1] \*SYSTEM org.eclipse.jetty.server.session - DefaultSessionIdManager workerName=node0  
> 2025-03-26 05:08:42,175+0100 INFO [jetty-main-1] \*SYSTEM org.eclipse.jetty.server.session - No SessionScavenger set, using defaults  
> 2025-03-26 05:08:42,176+0100 INFO [jetty-main-1] \*SYSTEM org.eclipse.jetty.server.session - node0 Scavenging every 660000ms  
> 2025-03-26 05:08:42,190+0100 INFO [jetty-main-1] \*SYSTEM org.sonatype.nexus.bootstrap.osgi.BootstrapListener - Initializing  
> 2025-03-26 05:08:42,200+0100 INFO [jetty-main-1] \*SYSTEM org.sonatype.nexus.bootstrap.osgi.OssNexusEdition - Loading OSS Edition  
> 2025-03-26 05:08:42,202+0100 ERROR [jetty-main-1] \*SYSTEM org.sonatype.nexus.bootstrap.osgi.BootstrapListener - Failed to initialize  
> java.lang.IllegalStateException: The maximum Java version for OrientDb is Java 11. Please check current Java version meets this requirement.  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.ensureOrientRunningWithCorrectJavaRuntime(NexusEditionPropertiesConfigurer.java:159)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.selectDbFeature(NexusEditionPropertiesConfigurer.java:148)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.selectDatastoreFeature(NexusEditionPropertiesConfigurer.java:137)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.getPropertiesFromConfiguration(NexusEditionPropertiesConfigurer.java:58)  
> at org.sonatype.nexus.bootstrap.osgi.BootstrapListener.contextInitialized(BootstrapListener.java:58)  
> at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1073)  
> at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:572)  
> at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:1002)  
> at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:765)  
> at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)  
> at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)  
> at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)  
> at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)  
> at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)  
> at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at com.codahale.metrics.jetty9.InstrumentedHandler.doStart(InstrumentedHandler.java:101)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.server.Server.start(Server.java:423)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at org.eclipse.jetty.server.Server.doStart(Server.java:387)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:274)  
> 2025-03-26 05:08:42,202+0100 WARN [jetty-main-1] \*SYSTEM org.eclipse.jetty.webapp.WebAppContext - Failed startup of context o.e.j.w.WebAppContext@50ae1a0{Sonatype Nexus,/nexus3,null,UNAVAILABLE}  
> java.lang.IllegalStateException: The maximum Java version for OrientDb is Java 11. Please check current Java version meets this requirement.  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.ensureOrientRunningWithCorrectJavaRuntime(NexusEditionPropertiesConfigurer.java:159)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.selectDbFeature(NexusEditionPropertiesConfigurer.java:148)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.selectDatastoreFeature(NexusEditionPropertiesConfigurer.java:137)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.getPropertiesFromConfiguration(NexusEditionPropertiesConfigurer.java:58)  
> at org.sonatype.nexus.bootstrap.osgi.BootstrapListener.contextInitialized(BootstrapListener.java:58)  
> at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1073)  
> at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:572)  
> at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:1002)  
> at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:765)  
> at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)  
> at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)  
> at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)  
> at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)  
> at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)  
> at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at com.codahale.metrics.jetty9.InstrumentedHandler.doStart(InstrumentedHandler.java:101)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.server.Server.start(Server.java:423)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at org.eclipse.jetty.server.Server.doStart(Server.java:387)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:274)  
> 2025-03-26 05:08:42,203+0100 INFO [jetty-main-1] \*SYSTEM org.eclipse.jetty.server.session - node0 Stopped scavenging  
> 2025-03-26 05:08:42,211+0100 ERROR [jetty-main-1] \*SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Failed to start  
> java.lang.IllegalStateException: The maximum Java version for OrientDb is Java 11. Please check current Java version meets this requirement.  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.ensureOrientRunningWithCorrectJavaRuntime(NexusEditionPropertiesConfigurer.java:159)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.selectDbFeature(NexusEditionPropertiesConfigurer.java:148)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.selectDatastoreFeature(NexusEditionPropertiesConfigurer.java:137)  
> at org.sonatype.nexus.bootstrap.osgi.NexusEditionPropertiesConfigurer.getPropertiesFromConfiguration(NexusEditionPropertiesConfigurer.java:58)  
> at org.sonatype.nexus.bootstrap.osgi.BootstrapListener.contextInitialized(BootstrapListener.java:58)  
> at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1073)  
> at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:572)  
> at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:1002)  
> at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:765)  
> at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)  
> at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)  
> at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)  
> at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)  
> at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)  
> at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at com.codahale.metrics.jetty9.InstrumentedHandler.doStart(InstrumentedHandler.java:101)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)  
> at org.eclipse.jetty.server.Server.start(Server.java:423)  
> at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)  
> at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)  
> at org.eclipse.jetty.server.Server.doStart(Server.java:387)  
> at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)  
> at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:274)  
> 2025-03-26 05:08:42,232+0100 INFO [FelixStartLevel] \*SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Stopping  
> 2025-03-26 05:08:42,233+0100 INFO [FelixStartLevel] \*SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Stopped

It seems that Nexus is still trying to use OrientDB initially. I am using Debian Bookworm as the base image and Java 17 as the default Java version for Nexus 3.70.1-02. The goal is to start Nexus 3.70.1-02 with the H2 database for a fresh deployment.

Our intention is to test Nexus 3.70.1-02 with the H2 database, and once successful, we plan to migrate from OrientDB to H2.

Regarding the [migration guide](https://help.sonatype.com/en/migrating-to-a-new-database.html?&_ga=2.173445857.377444458.1742787575-997279229.1682508409#migrating-from-orientdb-to-h2-162010) could you clarify the actual purpose of backing up the old database? Is it a precautionary step, or is it mandatory to back up the old database before starting the DB migrator?

Apologies for asking so many questions, but we want to ensure we’re on the right track and planning this activity correctly.

Your guidance will be greatly appreciated

regards,  
SAM

---

<div class="post-metadata">

**Author:** ![laurencet](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/laurencet/32/3456_2.png) [@laurencet](https://community.sonatype.com/u/laurencet)\
**Post date:** [March 26, 2025, 3:57pm UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/6 "2025-03-26T15:57:44Z")

</div>

Hey Sam,

Have you deleted the ‘`sonatype-work`’ directory since your previous attempts? Once nexus has started once with Orient then it will default to that. That being said it looks like Nexus is still trying to use Orient. You shouldn’t need to add anything to the Dockerfile just to your compose file should be sufficient.

Here is an example of running Nexus 3 with docker compose which should work for H2:

```auto
services:
  nexus3:
    image: sonatype/nexus3:3.70.4
    ports:
      - "8081:8081"
    environment:
      - INSTALL4J_ADD_VM_PARAMS=-Xms4G -Xmx4G -XX:MaxDirectMemorySize=4G -Djava.util.prefs.userRoot=/nexus-data/javaprefs -Dnexus.licenseFile=/etc/nexus-license/license.lic
      - NEXUS_DATASTORE_ENABLED=true
    volumes:
      - /opt/nexus/docker-volumes/docker-compose-nexus3:/nexus-data

```

---

<div class="post-metadata">

**Author:** ![laurencet](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/laurencet/32/3456_2.png) [@laurencet](https://community.sonatype.com/u/laurencet)\
**Post date:** [March 26, 2025, 4:30pm UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/7 "2025-03-26T16:30:14Z")

</div>

> [@sameer29nov](#):
>
> Regarding the [migration guide](https://help.sonatype.com/en/migrating-to-a-new-database.html?&_ga=2.173445857.377444458.1742787575-997279229.1682508409#migrating-from-orientdb-to-h2-162010) could you clarify the actual purpose of backing up the old database? Is it a precautionary step, or is it mandatory to back up the old database before starting the DB migrator?

Apologies, forgot to address this part. The task to export the DB files is a requirement as these are used for the migration utility. As with any activity of this type, its always recommended to take comprehensive backups (and test them)!

---

<div class="post-metadata">

**Author:** ![sameer29nov](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sameer29nov](https://community.sonatype.com/u/sameer29nov)\
**Post date:** [March 27, 2025, 6:57am UTC](https://community.sonatype.com/t/nexus-3-70-1-02-with-h2-database/14681/8 "2025-03-27T06:57:53Z")

</div>

@laurencet

Yes, I am removing the old repository to start fresh.  
I’m not sure, maybe I’m missing something. Even after adding `NEXUS_DATASTORE_ENABLED=true`, in ENV it still points to OrientDB.

But the interesting part is that I created this path: `/opt/sonatype/sonatype-work/nexus3/etc/` and added my preconfigured `nexus.properties`.  
Then, Nexus started with the H2 database for fresh deployments. 🙂

For now, this is enough for me to start my testing, and I really appreciate your support and time in addressing my query.

I will mark his as resolved, but share my observations just for tracking. Thank you once again!!!
