Namespace problem in pedestal

I am using the beginner guide in the pedestal guide but when trying to use use a namespace (require 'test) I get the following error messge:

"Execution error (FileNotFoundException) at user/eval2012 (REPL:1).
Could not locate test__init.class, test.clj or test.cljc on classpath." 

The same thing happens when trying (requiire 'hello)

I am using lein repl.

I have a directory called test and under src theres is a file called test.clj

test/src/test.clj:

(ns test
  (:require [io.pedestal.http :as http]
            [io.pedesteal.http.route :as route]))

test/src/hello.clj:

(defn respond-hello [request]
  {:status 200 :body "Herllo world"})

also, deps.edn:

{:deps
{io.pedestal/pedestal.service {:mvn/version “0.5.7”}
io.pedestal/pedestal.route {:mvn/version “0.5.7”}
io.pedestal/pedestal.jetty {:mvn/version “0.5.7”}
org.slf4j/slf4j-simple {:mvn/version “1.7.28”}}
:paths [“src”]}

any ideas?

Check that your directory structure is the one that was intended by whatever guide you are following. test/src/test.clj is unusual.

I am following the pedestal guide and the directory structure is correct

It might be helpful if you post your project.clj and the output of tree on your project directory…

I am just following the pedestal guide, the project three is just test/src/test.clj test/src/hello.clj
It might be a problem with lein repll. maybe clj will read the libs?

If you’re using Leiningen, you need a project.clj. If you’re using clj, you’ll need a deps.edn. It might be better to start with a simple project before diving into Pedestal (which is not necessarily beginner-friendly).
As it stands, you don’t have a way to build a classpath, and you don’t have any dependencies specified, so whatever it is you’re trying to do won’t work.

ok, according to the pedestal guide there is a project.clj file. Either I will download cli or create a project.clj file. Thanks anyway

added deps.edn

so this project.clj solved the problem:

(defproject pedestal "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [io.pedestal/pedestal.service "0.5.7"]
                 [io.pedestal/pedestal.route "0.5.7"]
                 [io.pedestal/pedestal.jetty "0.5.7"]]
  :main ^:skip-aot test
  :target-path "target/%s")

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.