jacobobryant / biff

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

Execution error (NullPointerException) at com.biffweb.tasks/dev (tasks.clj:290). #195

Closed jacoobes closed 4 months ago

jacoobes commented 4 months ago

Great work with biff! Im working on windows and im getting this error. It was working previously but then I edited a few of my own files and then i tried running the dev server again, and i get this error.

Execution error (NullPointerException) at com.biffweb.tasks/dev (tasks.clj:290).
Cannot invoke "clojure.lang.IFn.invoke()" because the return value of "clojure.lang.IFn.invoke(Object)" is null

Full report:

{:clojure.main/message
 "Execution error (NullPointerException) at com.biffweb.tasks/dev (tasks.clj:290).\r\nCannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null\r\n",
 :clojure.main/triage
 {:clojure.error/class java.lang.NullPointerException,
  :clojure.error/line 290,
  :clojure.error/cause
  "Cannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null",
  :clojure.error/symbol com.biffweb.tasks/dev,
  :clojure.error/source "tasks.clj",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.lang.NullPointerException,
    :message
    "Cannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null",
    :at [com.biffweb.tasks$dev invokeStatic "tasks.clj" 290]}],
  :trace
  [[com.biffweb.tasks$dev invokeStatic "tasks.clj" 290]
   [com.biffweb.tasks$dev invoke "tasks.clj" 262]
   [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
  "Cannot invoke \"clojure.lang.IFn.invoke()\" because the return value of \"clojure.lang.IFn.invoke(Object)\" is null"}}

image

I run with clj -M:dev dev. My clj version is Clojure CLI version (deps.clj) 1.11.2.1446 I have babashka installed

jacobobryant commented 4 months ago

Great work with biff!

Thanks!

Execution error (NullPointerException) at com.biffweb.tasks/dev (tasks.clj:290).

hmm, here's the line that error is referencing: https://github.com/jacobobryant/biff/blob/master/libs/tasks/src/com/biffweb/tasks.clj#L290

In resources/config.edn you should have a :biff.tasks/main-ns key that's set to the main namespace of your app (e.g. com.example). And in that namespace you should have a -main function that starts your app. If you renamed the file or renamed the -main function, that would trigger the NullPointerException.

jacoobes commented 4 months ago

oml, i must have accidentally messed with the namespace while editing, thank you!! https://github.com/jacoobes/airbin/commit/ef6ba58c62249763ab0f16a96fd19f77f3195c99