Could not locate clojure/data/json__init.class or clojure/data/json.clj on classpath

2,316 views
Skip to first unread message

larry google groups

unread,
Oct 25, 2012, 1:01:54 PM10/25/12
to clo...@googlegroups.com
I asked this previously but I thought I would start a new thread to go into more detail. This is driving me crazy. I was using json in my app and everything was working great. Then I did something, but I don't know what. Now it is broken.

My project.clj is:

(defproject who-is-logged-in "1.1"
  :description "When users arrive ...."
  :dependencies [
                 [org.clojure/clojure "1.3.0"]
                 [net.cgrand/moustache "1.1.0"]
                 [ring "1.1.5"]
                 [ring/ring-jetty-adapter "1.1.5"]
                 ]
  :main who-is-logged-in.core
  :jvm-opts ["-Xmx1000m"])


and the top of core.clj looks like this:

(ns who-is-logged-in.core
  (:gen-class)
  (:import (java.util Date)
           (java.io File))
  (:require clojure.string clojure.java.io who-is-logged-in.memory_display
            [clojure.data.json :as json])
  (:use   [net.cgrand.moustache :only [app delegate]]
          [ring.util.response]
          [ring.middleware.params]
          [ring.adapter.jetty :only [run-jetty]]))

I run "lein deps" and then "lein compile". I get this error:

Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/data/json__init.class or clojure/data/json.clj on classpath: , compiling:(core.clj:1)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3342)
    at clojure.lang.Compiler.compile1(Compiler.java:6985)
    at clojure.lang.Compiler.compile1(Compiler.java:6975)
    at clojure.lang.Compiler.compile(Compiler.java:7046)
    at clojure.lang.RT.compile(RT.java:385)
    at clojure.lang.RT.load(RT.java:425)
    at clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4610.invoke(core.clj:5386)
    at clojure.core$load.doInvoke(core.clj:5385)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5200)
    at clojure.core$compile$fn__4615.invoke(core.clj:5397)
    at clojure.core$compile.invoke(core.clj:5396)
    at user$eval27.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:6465)
    at clojure.lang.Compiler.eval(Compiler.java:6455)
    at clojure.lang.Compiler.eval(Compiler.java:6431)
    at clojure.core$eval.invoke(core.clj:2795)
    at clojure.main$eval_opt.invoke(main.clj:296)
    at clojure.main$initialize.invoke(main.clj:315)
    at clojure.main$null_opt.invoke(main.clj:348)
    at clojure.main$main.doInvoke(main.clj:426)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:405)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:518)
    at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate clojure/data/json__init.class or clojure/data/json.clj on classpath:


Like I said, this was working, and now it is broken. Can anyone guess why?









Jim foo.bar

unread,
Oct 25, 2012, 1:06:52 PM10/25/12
to clo...@googlegroups.com
On 25/10/12 18:01, larry google groups wrote:
> (:require clojure.string clojure.java.io who-is-logged-in.memory_display
> [clojure.data.json :as json])

I don't like this line...

try:

(:require [clojure.string :as st]
[clojure.java.io :as io]
[clojure.data.json :as json]
[who-is-logged-in.memory_display :as who]) ;;assuming this
is an ns you can reach

also try deleting all your class files and recompile...keep your eye on
the mailing list cos I think something changed with data.json...there is
a discussion currently going on...

Jim

Mayank Jain

unread,
Oct 25, 2012, 1:09:00 PM10/25/12
to clo...@googlegroups.com

To clean do
$ lein clean

Sent from phone. Please excuse brevity.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Dave Ray

unread,
Oct 25, 2012, 1:34:21 PM10/25/12
to clo...@googlegroups.com
Why don't you have clojure.data.json in your dependencies in
project.clj? That seems like a problem to me.

Dave
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com

larry google groups

unread,
Oct 25, 2012, 2:19:50 PM10/25/12
to clo...@googlegroups.com
>Why don't you have clojure.data.json in your dependencies in
>project.clj? That seems like a problem to me.

Ah, hell. Looks like I accidentally erased that line. Thanks for pointing that out.

svn diff -r r3166:3250 project.clj
Index: project.clj
===================================================================
--- project.clj    (revision 3166)
+++ project.clj    (revision 3250)
@@ -1,8 +1,9 @@
-(defproject who-is-logged-in "1.0.1"
+(defproject who-is-logged-in "1.1"

   :dependencies [[org.clojure/clojure "1.3.0"]
                  [net.cgrand/moustache "1.1.0"]
                  [ring "1.1.5"]
-                 [ring/ring-jetty-adapter "1.1.5"]]
+                 [ring/ring-jetty-adapter "1.1.5"]
+                 [org.clojure/data.json "0.2.0"]]
   :main who-is-logged-in.core
-  :jvm-opts ["-Xmx4000m"])
\ No newline at end of file
+  :jvm-opts ["-Xmx1000m"])
\ No newline at end of file
Reply all
Reply to author
Forward
0 new messages