Description
starting the anvil-app-server locally and initializing a new DB no longer works with the latest update
Steps to reproduce
- Create a new app or clone an existing one to your local machine
- delete the DB (usually .anvil-data)
- run
anvil-app-server --app .
This results in the following error
anvil-app-server --app .
Found Anvil App Server JAR in package directory
[INFO anvil.app-server.postgres] Launching embedded Postgres database. Find Postgres daemon logs in the ' .anvil-data ' directory.
java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'byte[] org.apache.commons.io.IOUtils.byteArray()'
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at clojure.core$deref_future.invokeStatic(core.clj:2317)
at clojure.core$future_call$reify__8544.deref(core.clj:7042)
at clojure.core$deref.invokeStatic(core.clj:2337)
at clojure.core$deref.invoke(core.clj:2323)
at anvil.app_server.postgres$start_postgres_with_timeout.invokeStatic(postgres.clj:47)
at anvil.app_server.postgres$start_postgres_with_timeout.invoke(postgres.clj:37)
at anvil.app_server.postgres$launch_bundled_db_BANG_.invokeStatic(postgres.clj:146)
at anvil.app_server.postgres$launch_bundled_db_BANG_.invoke(postgres.clj:87)
at anvil.app_server.run$with_bundled_postgres_if_configured.invokeStatic(run.clj:319)
at anvil.app_server.run$with_bundled_postgres_if_configured.invoke(run.clj:312)
at anvil.app_server.run$with_bundled_postgres_if_configured.invokeStatic(run.clj:313)
at anvil.app_server.run$with_bundled_postgres_if_configured.invoke(run.clj:312)
at anvil.app_server.run$_main.invokeStatic(run.clj:418)
at anvil.app_server.run$_main.doInvoke(run.clj:414)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at anvil.app_server.run.main(Unknown Source)
Caused by: java.lang.NoSuchMethodError: 'byte[] org.apache.commons.io.IOUtils.byteArray()'
at org.apache.commons.compress.utils.IOUtils.skip(IOUtils.java:282)
at org.apache.commons.compress.archivers.tar.TarArchiveInputStream.getNextTarEntry(TarArchiveInputStream.java:409)
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.extractTxz(EmbeddedPostgres.java:696)
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.prepareBinaries(EmbeddedPostgres.java:815)
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:133)
at io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:583)
at anvil.app_server.postgres$start_postgres_with_timeout$fn__527.invoke(postgres.clj:39)
at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)
at clojure.lang.AFn.call(AFn.java:18)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Failed to start built-in Postgres database: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'byte[] org.apache.commons.io.IOUtils.byteArray()'
More logs are available in .anvil-data/postgres.log.
Some common causes of this problem:
- Are you launching this server as 'root' on a UNIX system?
Postgres will not run as root; try launching the server as an ordinary user.
- Are you running this server on an unusual architecture or OS? (Linux/amd64)
Only new DBs are affected. Using a DB that was initialized with a previous version works fine
Environment
- Ubuntu 22.04
- Python 3.10
- Java: openjdk 17.0.11 2024-04-16 (also tested with java 11)
Workaround
- Use an already existing DB that worked previously
- Roll back to previous version of anvil-app-server (I rolled back to 1.11.0)