尝试使用 Luminus 模板和 H2 db 从 Leiningen 创建简单的示例应用程序。没什么特别的,我确实看到很多这样做的例子,但总是得到No suitable driver
.
lein new luminus guestbook +h2
cd guestbook
lein run
Syntax error (SQLException) compiling at (/private/var/folders/g2/tw6c1syn2hl_915p0xgc2hcm0000gn/T/form-init682714741074384097.clj:1:124).
No suitable driver
Full report at:
/var/folders/g2/tw6c1syn2hl_915p0xgc2hcm0000gn/T/clojure-2526208820906376199.edn
该文件包含:
{:clojure.main/message
"Syntax error (SQLException) compiling at (/private/var/folders/g2/tw6c1syn2hl_915p0xgc2hcm0000gn/T/form-init682714741074384097.clj:1:124).\nNo suitable driver\n",
:clojure.main/triage
{:clojure.error/phase :compile-syntax-check,
:clojure.error/line 1,
:clojure.error/column 124,
:clojure.error/source "form-init682714741074384097.clj",
:clojure.error/path
"/private/var/folders/g2/tw6c1syn2hl_915p0xgc2hcm0000gn/T/form-init682714741074384097.clj",
:clojure.error/class java.sql.SQLException,
:clojure.error/cause "No suitable driver"},
:clojure.main/trace
{:via
[{:type clojure.lang.Compiler$CompilerException,
:message
"Syntax error compiling at (/private/var/folders/g2/tw6c1syn2hl_915p0xgc2hcm0000gn/T/form-init682714741074384097.clj:1:124).",
:data
{:clojure.error/phase :compile-syntax-check,
:clojure.error/line 1,
:clojure.error/column 124,
:clojure.error/source
"/private/var/folders/g2/tw6c1syn2hl_915p0xgc2hcm0000gn/T/form-init682714741074384097.clj"},
:at [clojure.lang.Compiler load "Compiler.java" 7652]}
{:type java.lang.RuntimeException,
:message "could not start [#'guestbook.db.core/*db*] due to",
:at [mount.core$up$fn__441 invoke "core.cljc" 80]}
{:type java.lang.RuntimeException,
:message
"Failed to get driver instance for jdbcUrl=jdbc:postgresql://twcrone",
:at
[com.zaxxer.hikari.util.DriverDataSource
<init>
"DriverDataSource.java"
114]}
{:type java.sql.SQLException,
:message "No suitable driver",
:at [java.sql.DriverManager getDriver "DriverManager.java" 298]}],
:trace
[[java.sql.DriverManager getDriver "DriverManager.java" 298]
[com.zaxxer.hikari.util.DriverDataSource
<init>
"DriverDataSource.java"
106]
[com.zaxxer.hikari.pool.PoolBase
initializeDataSource
"PoolBase.java"
325]
[com.zaxxer.hikari.pool.PoolBase <init> "PoolBase.java" 114]
[com.zaxxer.hikari.pool.HikariPool <init> "HikariPool.java" 108]
[com.zaxxer.hikari.HikariDataSource
<init>
"HikariDataSource.java"
81]
[hikari_cp.core$make_datasource invokeStatic "core.clj" 268]
[hikari_cp.core$make_datasource invoke "core.clj" 265]
[conman.core$connect_BANG_ invokeStatic "core.clj" 162]
[conman.core$connect_BANG_ invoke "core.clj" 158]
[guestbook.db.core$eval13387$fn__13388 invoke "core.clj" 10]
[mount.core$record_BANG_ invokeStatic "core.cljc" 74]
[mount.core$record_BANG_ invoke "core.cljc" 73]
[mount.core$up$fn__441 invoke "core.cljc" 81]
[mount.core$up invokeStatic "core.cljc" 80]
[mount.core$up invoke "core.cljc" 78]
[mount.core$bring invokeStatic "core.cljc" 247]
[mount.core$bring invoke "core.cljc" 239]
[mount.core$start invokeStatic "core.cljc" 289]
[mount.core$start doInvoke "core.cljc" 281]
[clojure.lang.RestFn invoke "RestFn.java" 397]
[mount.core$start_with_args invokeStatic "core.cljc" 389]
[mount.core$start_with_args doInvoke "core.cljc" 385]
[clojure.lang.RestFn invoke "RestFn.java" 410]
[guestbook.core$start_app invokeStatic "core.clj" 52]
[guestbook.core$start_app invoke "core.clj" 51]
[guestbook.core$_main invokeStatic "core.clj" 75]
[guestbook.core$_main doInvoke "core.clj" 59]
[clojure.lang.RestFn invoke "RestFn.java" 397]
[clojure.lang.Var invoke "Var.java" 380]
[user$eval18339 invokeStatic "form-init682714741074384097.clj" 1]
[user$eval18339 invoke "form-init682714741074384097.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 7181]
[clojure.lang.Compiler eval "Compiler.java" 7171]
[clojure.lang.Compiler load "Compiler.java" 7640]
[clojure.lang.Compiler loadFile "Compiler.java" 7578]
[clojure.main$load_script invokeStatic "main.clj" 475]
[clojure.main$init_opt invokeStatic "main.clj" 477]
[clojure.main$init_opt invoke "main.clj" 477]
[clojure.main$initialize invokeStatic "main.clj" 508]
[clojure.main$null_opt invokeStatic "main.clj" 542]
[clojure.main$null_opt invoke "main.clj" 539]
[clojure.main$main invokeStatic "main.clj" 664]
[clojure.main$main doInvoke "main.clj" 616]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.main main "main.java" 40]],
:cause "No suitable driver",
:phase :compile-syntax-check}}
我已经从其他示例中尝试了各种变体。