Fork me on GitHub

Hi John, I am trying out your web apps tutorial. I have

(ns hurrlicode.railroad-barons
  (:require [http-kit-server :as app-server]
            [compojure.core :refer [defroutes GET]]))
in src/railroad_barons.clj and
{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.3"}
        http-kit            {:mvn/version "2.5.3"}
        compojure           {:mvn/version "1.6.2"}}
in deps.edn. But I get this error message:
1. Caused by
   Could not locate http_kit_server__init.class, http_kit_server.clj or
   http_kit_server.cljc on classpath. Please check that namespaces with dashes
   use underscores in the Clojure file name.
Any idea what's going wrong here?


Ok, :require [org.httpkit.server :as app-server] seems to work.


But now I get a similar error with Hiccup: :thinking_face: deps.edn:

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.3"}
        http-kit/http-kit   {:mvn/version "2.5.3"}
        ring/ring-core      {:mvn/version "1.8.1"}
        ring/ring-devel     {:mvn/version "1.8.1"}
        compojure/compojure {:mvn/version "1.6.2"}
        hiccup              {:mvn/version "1.0.5"}}
(ns hurrlicode.railroad-barons
  (:require [org.httpkit.server :as app-server]
            [compojure.core :refer [defroutes GET POST]]
            [ring.util.response :refer [response]]
            [hiccup.core :refer [html]]
            [ :refer [html5 include-js include-css]]
            [hiccup.element :refer [link-to]]))
Error message:
1. Caused by
   Could not locate hiccup/core__init.class, hiccup/core.clj or hiccup/core.cljc
   on classpath.


It works after I restarted Spacemacs.


@oliver.heck Are you restarting the REPL after adding the dependencies to the deps.edn file?


I guess you say that in every video - but I forgot. :face_with_hand_over_mouth:


Assuming the requires are spelt correctly and the relevant dependencies are added to the project configuration file (deps.edn), then the error suggests the REPL needs to be restarted. The JVM needs to restart to add a new dependency to the class path, so restarting the REPL (or stop / start the REPL) will add all the namespaces from the dependencies to the class path of the REPL.


Its easily done, I do it all the time. There is an unofficial way to hotload dependencies into a running REPL so you dont have to restart.


Although its pretty quick to stop/start a REPL when using Clojure CLI tools, as there is only one JVM.


Which video / tutorial are you following? It sounds like I need to update the namespaces used.


I think they are quite up to date in the banking app but a little outdated in the status monitor.


I am able to play around with hiccup now which will keep me busy for a while. Will look into the database topic a little later.


Does SPC m s X restart the REPL from within spacemacs?


I think thats an older binding as I dont have that one anymore. Are you on Spacemacs version 0.200 or version 0.300


The function to restart properly should be sesman-restart . If you are using cider-restart then that only refreshes the connection and does not reload all the namespaces in the repl. I find the names of some cider functions a little hard to understand... so I wrote this


If in doubt, use cider-quit and cider-jack-in to restart 🙂


The spacemacs book uses Spacemacs version 0.300 (the develop branch version), so if you have an older version of Spacemacs then some keybindings will be different


I think I am on the devel branch - at least it tells me that it's updating very frequently.


Ah yes, thats the develop branch of the Spacemacs configuration. There maybe some commits that have not been pulled for the configuration, but if everything is working then no need to keep up with the very latest.


Does spacemacs update the clojure layer automatically? I do not have anything with , m q


The Spacemacs configuration defines how all the layers work, including the key bindings. This is the approach I recommend when updating.


Most of the key binding changes over the last two years have been additive, but there are a few that changed.


I see, I have latest spacemacs version but never ever updated packages. Doing this now.


Strangely it says that all packages are up to date now but I still don't have anything under , m


...but I found out that I can click on "Clojure" tab in the status bar and get a menu where I can restart sesman. 🙂


My suggestion is that although you have Spacemacs version 0.300, it is several (many hundreds) of commits behind the current commit on that branch. I added the m sub-menu over a year ago. There will be a large number of commits if you did a pull of the latest Spacemacs, so suggest if you do pull the commits then you have a spare hour to fix anything that breaks (although I havent had any significant issues using develop for the last two years. If you do a pull of the latest develop branch, it is highly advisable to do a diff between your .spacemacs config and the spacemacs.template - use SPC f e D to run a diff in Spacemacs of these two files.

😲 1

Finally made the update. Your video was really helpful for that. Thanks! 🎯


Just FYI, In the last two years there have been nearly 5,000 commits to the Spacemacs project.


nice, i will have to try it again sometime, now that there is a language i can use it for