原因:java.lang.ClassNotFoundException:com.amazonaws.services.dynamodbv2.model.PutItemRequest

Caused by: java.lang.ClassNotFoundException: com.amazonaws.services.dynamodbv2.model.PutItemRequest

我正在尝试在 AWS 上的 dynamodb 上部署数据应用程序,但是当我检查 ec2 上的对等实例时,我注意到由于以下堆栈跟踪无法启动,这对确定失败原因没有帮助。

un 01, 2016 6:17:50 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class myapp.listener
java.lang.RuntimeException: could not start [#'myapp.db.core/conn] due to
        at mount.core$up$fn__390.invoke(core.cljc:92)
        at mount.core$up.invokeStatic(core.cljc:92)
        at mount.core$up.invoke(core.cljc:90)
        at mount.core$bring.invokeStatic(core.cljc:206)
        at mount.core$bring.invoke(core.cljc:198)
        at mount.core$start.invokeStatic(core.cljc:246)
        at mount.core$start.doInvoke(core.cljc:242)
        at clojure.lang.RestFn.invoke(RestFn.java:397)
        at myapp.handler$init.invokeStatic(handler.clj:27)
        at myapp.handler$init.invoke(handler.clj:21)
        at clojure.lang.Var.invoke(Var.java:375)
        at myapp.listener$_contextInitialized.invokeStatic(listener.clj:1)
        at myapp.listener$_contextInitialized.invoke(listener.clj:1)
        at myapp.listener.contextInitialized(Unknown Source)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1980)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:278)
        at clojure.lang.RT.classForName(RT.java:2168)
        at clojure.lang.RT.classForName(RT.java:2177)
        at clojure.lang.RT.loadClassForName(RT.java:2196)
        at clojure.lang.RT.load(RT.java:443)
        at clojure.lang.RT.load(RT.java:419)
        at clojure.core$load$fn__5677.invoke(core.clj:5893)
        at clojure.core$load.invokeStatic(core.clj:5892)
        at clojure.core$load.doInvoke(core.clj:5876)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5697)
        at clojure.core$load_one.invoke(core.clj:5692)
        at clojure.core$load_lib$fn__5626.invoke(core.clj:5737)
        at clojure.core$load_lib.invokeStatic(core.clj:5736)
        at clojure.core$load_lib.doInvoke(core.clj:5717)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$load_libs.invokeStatic(core.clj:5774)
        at clojure.core$load_libs.doInvoke(core.clj:5758)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$require.invokeStatic(core.clj:5796)
        at clojure.core$require.doInvoke(core.clj:5796)
        at clojure.lang.RestFn.invoke(RestFn.java:619)
        at datomic.ddb_cluster$loading__5340__auto____18593.invoke(ddb_cluster.clj:4)
        at datomic.ddb_cluster__init.load(Unknown Source)
        at datomic.ddb_cluster__init.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:278)
        at clojure.lang.RT.classForName(RT.java:2168)
        at clojure.lang.RT.classForName(RT.java:2168)
        at clojure.lang.RT.classForName(RT.java:2177)
        at clojure.lang.RT.loadClassForName(RT.java:2196)
        at clojure.lang.RT.load(RT.java:443)
        at clojure.lang.RT.load(RT.java:419)
        at clojure.core$load$fn__5677.invoke(core.clj:5893)
        at clojure.core$load.invokeStatic(core.clj:5892)
        at clojure.core$load.doInvoke(core.clj:5876)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5697)
        at clojure.core$load_one.invoke(core.clj:5692)
        at clojure.core$load_lib$fn__5626.invoke(core.clj:5737)
        at clojure.core$load_lib.invokeStatic(core.clj:5736)
        at clojure.core$load_lib.doInvoke(core.clj:5717)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$load_libs.invokeStatic(core.clj:5774)
        at clojure.core$load_libs.doInvoke(core.clj:5758)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$require.invokeStatic(core.clj:5796)
        at clojure.core$require.doInvoke(core.clj:5796)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at datomic.require$require_and_run.doInvoke(require.clj:21)
        at clojure.lang.RestFn.invoke(RestFn.java:423)
        at datomic.coordination_ext$fn__7778.invoke(coordination_ext.clj:15)
        at clojure.lang.MultiFn.invoke(MultiFn.java:229)
        at datomic.coordination$create_system_cluster.invoke(coordination.clj:92)
        at datomic.peer$send_admin_request$fn__8606.invoke(peer.clj:751)
        at datomic.peer$send_admin_request.invoke(peer.clj:745)
        at datomic.peer$create_database.invoke(peer.clj:765)
        at datomic.peer$create_database.invoke(peer.clj:757)
        at clojure.lang.Var.invoke(Var.java:379)
        at datomic.Peer.createDatabase(Peer.java:117)
        at datomic.api$create_database.invoke(api.clj:19)
        at myapp.db.core$fn__43.invokeStatic(core.clj:24)
        at myapp.db.core$fn__43.invoke(core.clj:22)
        at mount.core$record_BANG_.invokeStatic(core.cljc:86)
        at mount.core$record_BANG_.invoke(core.cljc:85)
        at mount.core$up$fn__390.invoke(core.cljc:93)
        ... 26 more
Caused by: java.lang.ClassNotFoundException: com.amazonaws.services.dynamodbv2.model.PutItemRequest
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:278)
        at clojure.lang.RT.classForName(RT.java:2168)
        at clojure.lang.RT.classForName(RT.java:2177)
        at datomic.ddb__init.__init0(Unknown Source)
        at datomic.ddb__init.<clinit>(Unknown Source)
        ... 96 more

异常告诉您 class 路径中缺少以下 class:

ClassNotFoundException: com.amazonaws.services.dynamodbv2.model.PutItemRequest 

根据datomic instructions,您需要包括:

[com.amazonaws/aws-java-sdk-dynamodb "1.9.39"]

在你的 lein 项目中。