Datomic throws ActiveMQInternalErrorException when connecting to restored database

女生的网名这么多〃 提交于 2021-02-20 02:17:26

问题


I backed up a Datomic v0.9.5786 database from :dev storage:

~/datomic/datomic-pro-0.9.5786/bin/datomic -Xmx4g -Xms4g backup-db datomic:dev://localhost:4334/acct file:/Users/petrus/acct.datomic
Copied 0 segments, skipped 0 segments.
Copied 414 segments, skipped 0 segments.
:succeeded

Restoring the backup to a newer version of Datomic Pro v1.0.6202 on my othre laptop apparently succeeds:

➜  datomic-pro-1.0.6202 bin/datomic -Xmx4g -Xms4g restore-db file:/Users/petrus/Projects/acct/resources/data/acct.datomic datomic:dev://localhost:4334/acct
Copied 0 segments, skipped 0 segments.
Copied 414 segments, skipped 0 segments.
:succeeded
{:event :restore, :db acct, :basis-t 38265, :inst #inst "2020-10-22T10:03:31.186-00:00"}

I restarted the Dev transactor as described in the docs, but when I try to connect from the REPL, Datomic throws:

(d/connect "datomic:dev://localhost:4334/acct")
=> Execution error (ActiveMQInternalErrorException) at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl/sendBlocking (ChannelImpl.java:404).
null

Attempts to (d/delete-database "datomic:dev://localhost:4334/acct") fail with the same error, but trying to connect to non-existent DB cleanly throws "catalog does not exist."

I repeated the backup/restore process after installing Datomic Pro v1.0.6202 on the source machine so that the source and destination versions would match, but the same symptoms occur when connecting to the restored DB.

Let's see what happens when I try to create a fresh database:

(d/connect "datomic:dev://localhost:4334/newdb")
=> Execution error at datomic.peer/get-connection$fn (peer.clj:661).
Could not find newdb in catalog
(d/create-database "datomic:dev://localhost:4334/newdb")
=> Execution error (ActiveMQInternalErrorException) at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl/sendBlocking (ChannelImpl.java:404).
null

Hmm, I'm starting to think I've found a bug in Datomic, or there is a problem with my local JDK (OpenJDK 15).

So I create a new Clojure project with only 1.10.1 and Datomic Pro v1.0.6202 in deps.edn:

{:mvn/repos {"my.datomic.com" {:url "https://my.datomic.com/repo"}}
 :deps      {org.clojure/clojure     {:mvn/version "1.10.1"}
             com.datomic/datomic-pro {:mvn/version "1.0.6202"}}}
             
➜  clj
Clojure 1.10.1
user=> (require '[datomic.api :as d])
nil
user=> (d/connect "datomic:dev://localhost:4334/newdb")
Execution error at datomic.peer/get-connection$fn (peer.clj:661).
Could not find newdb in catalog
user=> (d/create-database "datomic:dev://localhost:4334/newdb")
Execution error (ActiveMQInternalErrorException) at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl/sendBlocking (ChannelImpl.java:404).

Could there be a weird conflict somewhere? Let's see what Maven says about the dependency tree:

➜  datomic-debug clj -Spom
➜  datomic-debug mvn dependency:tree -Dverbose=true
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< datomic-debug:datomic-debug >---------------------
[INFO] Building datomic-debug 0.1.0
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from clojars: https://repo.clojars.org/com/google/guava/guava/18.0/guava-18.0.jar
Downloading from my.datomic.com: https://my.datomic.com/repo/com/google/guava/guava/18.0/guava-18.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/google/guava/guava/18.0/guava-18.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/guava/guava/18.0/guava-18.0.jar (2.3 MB at 2.9 MB/s)
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ datomic-debug ---
[INFO] datomic-debug:datomic-debug:jar:0.1.0
[INFO] +- org.clojure:clojure:jar:1.10.1:compile
[INFO] |  +- org.clojure:spec.alpha:jar:0.2.176:compile
[INFO] |  \- org.clojure:core.specs.alpha:jar:0.2.44:compile
[INFO] \- com.datomic:datomic-pro:jar:1.0.6202:compile
[INFO]    +- (org.clojure:clojure:jar:1.8.0:compile - omitted for conflict with 1.10.1)
[INFO]    +- org.clojure:tools.cli:jar:0.3.5:compile
[INFO]    +- org.fressian:fressian:jar:0.6.5:compile
[INFO]    +- commons-codec:commons-codec:jar:1.10:compile
[INFO]    +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO]    |  \- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO]    +- org.slf4j:slf4j-nop:jar:1.7.22:compile
[INFO]    |  \- (org.slf4j:slf4j-api:jar:1.7.22:compile - omitted for duplicate)
[INFO]    +- org.slf4j:log4j-over-slf4j:jar:1.7.22:runtime
[INFO]    |  \- (org.slf4j:slf4j-api:jar:1.7.22:runtime - omitted for duplicate)
[INFO]    +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO]    |  \- (org.slf4j:slf4j-api:jar:1.7.22:compile - omitted for duplicate)
[INFO]    +- org.apache.activemq:artemis-core-client:jar:1.5.6:compile
[INFO]    |  +- org.apache.activemq:artemis-commons:jar:1.5.6:compile
[INFO]    |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO]    |  |  +- (io.netty:netty-all:jar:4.1.5.Final:compile - omitted for duplicate)
[INFO]    |  |  +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO]    |  |  |  \- (commons-collections:commons-collections:jar:3.2.1:compile - omitted for conflict with 3.2.2)
[INFO]    |  |  \- (com.google.guava:guava:jar:19.0:compile - omitted for conflict with 18.0)
[INFO]    |  +- (io.netty:netty-all:jar:4.1.5.Final:compile - omitted for conflict with 4.1.32.Final)
[INFO]    |  +- org.apache.geronimo.specs:geronimo-json_1.0_spec:jar:1.0-alpha-1:compile
[INFO]    |  \- org.apache.johnzon:johnzon-core:jar:0.9.5:compile
[INFO]    +- io.netty:netty-all:jar:4.1.32.Final:compile
[INFO]    +- com.datomic:query-support:jar:0.8.27:compile
[INFO]    +- com.h2database:h2:jar:1.3.171:compile
[INFO]    +- com.datomic:datomic-lucene-core:jar:3.3.0:compile
[INFO]    +- com.google.guava:guava:jar:18.0:compile
[INFO]    +- net.spy:spymemcached:jar:2.11.4:compile
[INFO]    +- org.apache.httpcomponents:httpclient:jar:4.5.9:compile
[INFO]    |  +- org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO]    |  \- (commons-codec:commons-codec:jar:1.11:compile - omitted for conflict with 1.10)
[INFO]    +- org.apache.tomcat:tomcat-jdbc:jar:7.0.27:compile
[INFO]    |  \- org.apache.tomcat:tomcat-juli:jar:7.0.27:compile
[INFO]    +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO]    \- org.codehaus.janino:commons-compiler-jdk:jar:3.0.12:compile
[INFO]       \- org.codehaus.janino:commons-compiler:jar:3.0.12:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.181 s
[INFO] Finished at: 2020-10-24T13:15:47+01:00
[INFO] ------------------------------------------------------------------------

The same happens whether I'm using OpenJDK 15 or Oracle's JDK 15. I also tried deleting my Datomic data folder before starting Datomic.


回答1:


The Datomic transactor requires Java 8 and does not support newer versions yet. Solved by switching transactor env to OpenJDK v1.8.0_272:

brew cask install adoptopenjdk8
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
bin/transactor config/dev-transactor.properties

I lost 10 hours on this. Maybe if the transactor tried to connect to itself on startup as a sanity check, it could warn the user early.



来源:https://stackoverflow.com/questions/64512606/datomic-throws-activemqinternalerrorexception-when-connecting-to-restored-databa

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!