jacobobryant / biff

A Clojure web framework for solo developers.
https://biffweb.com
MIT License
876 stars 41 forks source link

Error when following "getting started" instructions on Linux #234

Open ttn-ttn opened 6 days ago

ttn-ttn commented 6 days ago

I followed the "Getting started" instructions on Linux. When running clj -M:dev dev the following error happens:

{:clojure.main/message
 "Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (REPL:-1).\norg.eclipse.jetty.servlet.ServletContextHandler\n",
 :clojure.main/triage
 {:clojure.error/class java.lang.ClassNotFoundException,
  :clojure.error/line -1,
  :clojure.error/cause
  "org.eclipse.jetty.servlet.ServletContextHandler",
  :clojure.error/symbol java.net.URLClassLoader/findClass,
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.Compiler$CompilerException,
    :message
    "Syntax error macroexpanding at (ring/adapter/jetty9.clj:1:1).",
    :data
    {:clojure.error/phase :execution,
     :clojure.error/line 1,
     :clojure.error/column 1,
     :clojure.error/source "ring/adapter/jetty9.clj"},
    :at [clojure.lang.Compiler load "Compiler.java" 7665]}
   {:type java.lang.ClassNotFoundException,
    :message "org.eclipse.jetty.servlet.ServletContextHandler",
    :at [java.net.URLClassLoader findClass nil -1]}],
  :trace
  [[java.net.URLClassLoader findClass nil -1]
   [clojure.lang.DynamicClassLoader
    findClass
    "DynamicClassLoader.java"
    69]
   [java.lang.ClassLoader loadClass nil -1]
   [clojure.lang.DynamicClassLoader
    loadClass
    "DynamicClassLoader.java"
    77]
   [java.lang.ClassLoader loadClass nil -1]
   [java.lang.Class forName0 nil -2]
   [java.lang.Class forName nil -1]
   [java.lang.Class forName nil -1]
   [clojure.lang.RT classForName "RT.java" 2209]
   [clojure.lang.RT classForNameNonLoading "RT.java" 2222]
   [ring.adapter.jetty9$eval23036$loading__6789__auto____23037
    invoke
    "jetty9.clj"
    1]
   [ring.adapter.jetty9$eval23036 invokeStatic "jetty9.clj" 1]
   [ring.adapter.jetty9$eval23036 invoke "jetty9.clj" 1]
   [clojure.lang.Compiler eval "Compiler.java" 7194]
   [clojure.lang.Compiler eval "Compiler.java" 7183]
   [clojure.lang.Compiler load "Compiler.java" 7653]
   [clojure.lang.RT loadResourceScript "RT.java" 381]
   [clojure.lang.RT loadResourceScript "RT.java" 372]
   [clojure.lang.RT load "RT.java" 459]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 1289]
   [com.biffweb.impl.misc$eval1309$loading__6789__auto____1310
    invoke
    "misc.clj"
    1]
   [com.biffweb.impl.misc$eval1309 invokeStatic "misc.clj" 1]
   [com.biffweb.impl.misc$eval1309 invoke "misc.clj" 1]
   [clojure.lang.Compiler eval "Compiler.java" 7194]
   [clojure.lang.Compiler eval "Compiler.java" 7183]
   [clojure.lang.Compiler load "Compiler.java" 7653]
   [clojure.lang.RT loadResourceScript "RT.java" 381]
   [clojure.lang.RT loadResourceScript "RT.java" 372]
   [clojure.lang.RT load "RT.java" 459]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 703]
   [com.biffweb.impl.auth$eval1303$loading__6789__auto____1304
    invoke
    "auth.clj"
    1]
   [com.biffweb.impl.auth$eval1303 invokeStatic "auth.clj" 1]
   [com.biffweb.impl.auth$eval1303 invoke "auth.clj" 1]
   [clojure.lang.Compiler eval "Compiler.java" 7194]
   [clojure.lang.Compiler eval "Compiler.java" 7183]
   [clojure.lang.Compiler load "Compiler.java" 7653]
   [clojure.lang.RT loadResourceScript "RT.java" 381]
   [clojure.lang.RT loadResourceScript "RT.java" 372]
   [clojure.lang.RT load "RT.java" 459]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 2088]
   [com.biffweb$eval1297$loading__6789__auto____1298
    invoke
    "biffweb.clj"
    1]
   [com.biffweb$eval1297 invokeStatic "biffweb.clj" 1]
   [com.biffweb$eval1297 invoke "biffweb.clj" 1]
   [clojure.lang.Compiler eval "Compiler.java" 7194]
   [clojure.lang.Compiler eval "Compiler.java" 7183]
   [clojure.lang.Compiler load "Compiler.java" 7653]
   [clojure.lang.RT loadResourceScript "RT.java" 381]
   [clojure.lang.RT loadResourceScript "RT.java" 372]
   [clojure.lang.RT load "RT.java" 459]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn invoke "RestFn.java" 1523]
   [com.jijo$eval1291$loading__6789__auto____1292 invoke "jijo.clj" 1]
   [com.jijo$eval1291 invokeStatic "jijo.clj" 1]
   [com.jijo$eval1291 invoke "jijo.clj" 1]
   [clojure.lang.Compiler eval "Compiler.java" 7194]
   [clojure.lang.Compiler eval "Compiler.java" 7183]
   [clojure.lang.Compiler load "Compiler.java" 7653]
   [clojure.lang.RT loadResourceScript "RT.java" 381]
   [clojure.lang.RT loadResourceScript "RT.java" 372]
   [clojure.lang.RT load "RT.java" 459]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6908 invoke "core.clj" 6161]
   [clojure.core$load invokeStatic "core.clj" 6160]
   [clojure.core$load doInvoke "core.clj" 6144]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5933]
   [clojure.core$load_one invoke "core.clj" 5928]
   [clojure.core$load_lib$fn__6850 invoke "core.clj" 5975]
   [clojure.core$load_lib invokeStatic "core.clj" 5974]
   [clojure.core$load_lib doInvoke "core.clj" 5953]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6016]
   [clojure.core$load_libs doInvoke "core.clj" 6000]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6038]
   [clojure.core$require doInvoke "core.clj" 6038]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$serialized_require invokeStatic "core.clj" 6114]
   [clojure.core$requiring_resolve invokeStatic "core.clj" 6123]
   [clojure.core$requiring_resolve invoke "core.clj" 6117]
   [com.biffweb.tasks$dev invokeStatic "tasks.clj" 314]
   [com.biffweb.tasks$dev invoke "tasks.clj" 286]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$apply invoke "core.clj" 662]
   [com.biffweb.task_runner$run_task invokeStatic "task_runner.clj" 47]
   [com.biffweb.task_runner$run_task doInvoke "task_runner.clj" 35]
   [clojure.lang.RestFn invoke "RestFn.java" 410]
   [clojure.lang.AFn applyToHelper "AFn.java" 154]
   [clojure.lang.RestFn applyTo "RestFn.java" 132]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$apply invoke "core.clj" 662]
   [com.biffweb.task_runner$_main invokeStatic "task_runner.clj" 58]
   [com.biffweb.task_runner$_main doInvoke "task_runner.clj" 49]
   [clojure.lang.RestFn invoke "RestFn.java" 425]
   [clojure.lang.AFn applyToHelper "AFn.java" 156]
   [clojure.lang.RestFn applyTo "RestFn.java" 132]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.main$main_opt invokeStatic "main.clj" 514]
   [clojure.main$main_opt invoke "main.clj" 510]
   [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 "org.eclipse.jetty.servlet.ServletContextHandler",
  :phase :execution}}
jacobobryant commented 3 days ago

Hm--I just tried making a new project (clj -M -e '(load-string (slurp "https://biffweb.com/new.clj"))'; clj -M:dev dev) and it worked for me. I'm on Ubuntu. Looks like you're not able to import ServletContextHandler. As a minimal repro, I assume if you run the following you'll get an error?

$ clj
Clojure 1.11.1
user=> (import '[org.eclipse.jetty.servlet ServletContextHandler])
org.eclipse.jetty.servlet.ServletContextHandler

What's the output of clj -A:dev -Stree? Maybe the dependencies got mixed up somehow. I've attached mine ( tree.txt).

ttn-ttn commented 3 days ago

Thanks for your response. I must mention I'm on Guix, which is an unusual distribution; however I don't see how that could make a difference in this case (but it seems to do). I also don't know Java and just know the basics of Clojure, so I may be missing something obvious.

As a minimal repro, I assume if you run the following you'll get an error?

Yes:

user=> (import '[org.eclipse.jetty.servlet ServletContextHandler])
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (REPL:-1).
org.eclipse.jetty.servlet.ServletContextHandler

What's the output of clj -A:dev -Stree?

Here it is: tree.txt It's different from yours, however I don't know if the differences are of any significance.