Geting error using seesaw on the lein repl - clojure

Trying to go through this tutorial for seesaw gui library i get the following error as i run lein repl.
Any ideas what the problem is and how to fix it?
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
WARNING!!! version ranges found for:
[seesaw "1.4.2" :exclusions [org.clojure/tools.trace]] -> [j18n "1.0.1"] -> [org.clojure/clojure "[1.2,1.5)"]
Consider using [seesaw "1.4.2" :exclusions [org.clojure/clojure org.clojure/tools.trace]].
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Error loading cider.nrepl.middleware.apropos: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.classpath: java.lang.RuntimeException: Unable to resolve symbol: response-for in this context, compiling:(cider/nrepl/middleware/classpath.clj:15)
Error loading cider.nrepl.middleware.complete: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.debug: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.format: java.lang.RuntimeException: Unable to resolve symbol: defprotocol+ in this context, compiling:(deps/cljfmt/v0v1v10/deps/rewrite_clj/v0v4v12/rewrite_clj/node/protocols.clj:9)
Error loading cider.nrepl.middleware.info: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.inspect: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.macroexpand: java.lang.RuntimeException: Unable to resolve symbol: response-for in this context, compiling:(cider/nrepl/middleware/macroexpand.clj:73)
Error loading cider.nrepl.middleware.ns: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.pprint: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.refresh: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.resource: java.lang.RuntimeException: Unable to resolve symbol: defsource in this context, compiling:(deps/compliment/v0v2v4/compliment/sources/resources.clj:42)
Error loading cider.nrepl.middleware.stacktrace: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.test: java.lang.RuntimeException: Unable to resolve symbol: some-> in this context, compiling:(cider/nrepl/middleware/util/cljs.clj:57)
Error loading cider.nrepl.middleware.trace: java.lang.RuntimeException: Unable to resolve symbol: response-for in this context, compiling:(cider/nrepl/middleware/trace.clj:16)
Error loading cider.nrepl.middleware.undef: java.lang.RuntimeException: Unable to resolve symbol: response-for in this context, compiling:(cider/nrepl/middleware/undef.clj:19)
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: cider.nrepl.middleware.apropos/wrap-apropos in this context, compiling:(/tmp/form-init2232335588436189028.clj:1)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6416)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3503)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6411)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3503)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6411)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5837)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6409)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.analyze(Compiler.java:6177)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5572)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5008)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3629)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6407)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
at clojure.lang.Compiler.eval(Compiler.java:6462)
at clojure.lang.Compiler.eval(Compiler.java:6455)
at clojure.lang.Compiler.eval(Compiler.java:6455)
at clojure.lang.Compiler.load(Compiler.java:6902)
at clojure.lang.Compiler.loadFile(Compiler.java:6863)
at clojure.main$load_script.invoke(main.clj:282)
at clojure.main$init_opt.invoke(main.clj:287)
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.lang.RuntimeException: Unable to resolve var: cider.nrepl.middleware.apropos/wrap-apropos in this context
at clojure.lang.Util.runtimeException(Util.java:156)
at clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:613)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6409)
... 34 more**

You have this error:
Unable to resolve symbol: some->
some-> has been added in clojure 1.5
Your project.clj, which you wrote in a comment (you should've added to question by editing it... leaving it into the comments is almost unreadable and hostile to people that might be willing to help you) is:
(defproject sisaw "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0" ]
[seesaw "1.4.2-SNAPSHOT"]])
seesaw apparently is built upon clojure 1.4 [1] [2]
Leiningen is telling you:
WARNING!!! version ranges found for: [seesaw "1.4.2"] -> [j18n "1.0.1"] -> [org.clojure/clojure "[1.2,1.5)"] Consider using [seesaw "1.4.2" :exclusions [org.clojure/clojure]]
I understand [1.2,1.5) to mean a range from 1.2 to 1.5 with 1.2 included, 1.5 excluded
This means that a transitive dependency of seesaw prevents you from having clojure 1.5 as a dependency
Leiningen suggests to use [seesaw "1.4.2" :exclusions [org.clojure/clojure]] in your dependencies, so that the version resolution will pick up the one specified somewhere else (in your project.clj in this case) and ignore/exclude the one derived from seesaw (transitive) dependencies
I don't know if this is the only problem that you have, but it should at least partly explain it

Related

java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath

I was trying to understand Clojure spec. While setting up a clojure project I am getting following error while requiring the clojure.spec.alpha:
Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath., compiling:
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$script_opt.invokeStatic(main.clj:335)
at clojure.main$script_opt.invoke(main.clj:330)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
My project.clj:
(defproject testing "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/spec.alpha "0.1.143"]
[org.clojure/core.specs.alpha "0.1.10"]])
and core.clj:
(ns testing.core
(:require [clojure.spec.alpha :as s]))
(defn foo
"I don't do a whole lot."
[x]
(println x "Hello, World!"))
I will be thankful, if someone can help me out.
I did a lein clean and it started working
For those who experience this problem on 1.9, see https://groups.google.com/forum/#!msg/clojure/-ovhQXtzhgw/XBm_rfcICgAJ
With 1.8, you can just run java -jar clojure-1.8.0.jar that you have in your .m2 and RELP will start instantaneously. With 1.9, it's no longer the case. You need additional libraries that you might not have in your .m2 by default.
You will have them though if you install you Clojure based on official guide.
I had the same error, I don't know clojure but had to fix some NoClassDefFoundError exceptions testing Kafka Storm using org.apache.storm.kafka.KafkaSpout.
First exception was: NoClassDefFoundError: clojure/lang/IFn
This I fixed by including clojure-1.9.0.jar in the classpath.
Next, this exception:
FileNotFoundException: Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath
later realized they have another jar spec.alpha-0.1.143.jar for this.
Hope this helps someone else!
What worked for me was adding test.check library as a dependency to my classpath

Compilation error in eclipse [counterclockwise plugin]

I am getting this error whenever i try to run project.clj file:
CompilerException java.lang.RuntimeException: Unable to resolve symbol: defproject in this context,
I figured it out that the problem is with leiningen as i am also not able to create any projects in repl as well:
CompilerException java.lang.RuntimeException: Unable to resolve symbol: lein in this context,
Thought there might be a problem with counterclockwise plugin and re-installed, but same error.

Lein Midje :autotest throwing exception (No namespace found)

I am trying to setup autotest for midje. Currently, running lein midje works. However running lein midje :autottest gives me the stack trace below.
I run through my different namespaces and they all compile
Compiling 1 source files to /Users/oloo/Documents/work/cmp/target/classes
warning: Supported source version 'RELEASE_6' from annotation processor 'org.sonatype.guice.bean.scanners.index.SisuIndexAPT6' less than -source '1.7'
1 warning
======================================================================
Loading (cmp.models cmp.util cmp.repository.orderdeliveryschedule-repository cmp.repository.facility-repository cmp.repository.facility-cycle-data-repository cmp.views.layout cmp.routes.facility cmp.repository.item-repository cmp.repository.procurement-plan-repository cmp.routes.login cmp.excel-util cmp.repository.district-repository cmp.repository.facility-order-repository cmp.repository.facility-issue-repository cmp.routes.import-data cmp.test-util cmp.routes.item cmp.routes.district cmp.repository.user-repository cmp.routes.reports cmp.repository.category-repository cmp.routes.facility-issue cmp.routes.procurement-plan cmp.routes.facility-order cmp.handler cmp.repl cmp.repository.level-repository)
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.Exception: No namespace: cmp.routes.item found
at clojure.core$the_ns.invoke(core.clj:3760)
at clojure.core$ns_name.invoke(core.clj:3767)
at midje.repl$on_require_failure.invoke(repl.clj:387)
at midje.data.project_state$require_namespaces_BANG_$broken_source_file_QMARK___5874.invoke(project_state.clj:65)
at midje.data.project_state$require_namespaces_BANG_$shorten_ns_list_by_trying_first__5877.invoke(project_state.clj:69)
at midje.data.project_state$require_namespaces_BANG_.invoke(project_state.clj:75)
at midje.data.project_state$react_to_tracker_BANG_$fn__5889.invoke(project_state.clj:98)
at midje.repl$namespace_stream_checker.invoke(repl.clj:403)
at midje.data.project_state$react_to_tracker_BANG_.invoke(project_state.clj:94)
at midje.data.project_state$mkfn_COLON_scan_and_react$fn__5893$fn__5894.invoke(project_state.clj:109)
at clojure.lang.Atom.swap(Atom.java:37)
at clojure.core$swap_BANG_.invoke(core.clj:2160)
at midje.data.project_state$mkfn_COLON_scan_and_react$fn__5893.invoke(project_state.clj:107)
at midje.data.project_state$load_everything.invoke(project_state.clj:117)
at midje.repl$autotest.doInvoke(repl.clj:511)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at midje.repl$autotest.doInvoke(repl.clj:524)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval6032.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6609)
at clojure.lang.Compiler.eval(Compiler.java:6582)
at clojure.core$eval.invoke(core.clj:2852)
at clojure.main$eval_opt.invoke(main.clj:308)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Subprocess failed
See this: https://github.com/marick/Midje/issues/215
It says:
If a file being loaded by Midje at startup has a parse error (a reference to an unknown
symbol, etc.) that prevents it from being loaded successfully, Midje swallows the original
load error and instead prints the following error, which is much less useful.
I have suffered from this too: any little typo brings up this misleading error message.
I remember having problems with autotest and namespaces that :require or :use other namespaces using the [prefix ns1 ns2 ...] form. So, the following did not work:
(ns abc
(:use [abc def ghi]))
while this was okay:
(ns abc
(:use abc.def
abc.ghi))
Are you using that kind of syntax?

Another error trying "lein ritz" - Unable to resolve var: main/warn-chaining in this context, compiling:(ritz/swank/project.clj:98:11)

After solving this error I am now getting another error running lein ritz:
Caused by: java.lang.RuntimeException: Unable to resolve var: main/warn-chaining in this context, compiling:(ritz/swank/project.clj:98:11)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6567)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3573)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6009)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
This looks like you're running lein ritz outside of a project directory.
New versions of ritz will warn:
Couldn't find project.clj, which is needed for ritz
But lein ritz-nrepl still results in an uncaught java runtime exception:
Unable to resolve var: main/warn-chaining in this context
Solution: cd to your project directory, and try again from there.

What Is The Reason For The Lein Cyclic Dependency Error When I build uberwar?

Building ring server-headless works -- lein ring server-headless -- but when I try to build the war or uberwar I get the following error, and cannot figure out why this is happening.
No namespaces to :aot compile listed in project.clj.
Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(ring/util/servlet.clj:62)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6416)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
...
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.classForName(RT.java:2013)
at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:938)
at clojure.lang.Compiler$HostExpr.access$400(Compiler.java:710)
at clojure.lang.Compiler.macroexpand1(Compiler.java:6342)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6395)
... 69 more
Caused by: java.lang.Exception: Cyclic load dependency: [ /servlet ]->/ring/util/servlet->[ /servlet ]
at clojure.core$check_cyclic_dependency.invoke(core.clj:5288)
at clojure.core$load.doInvoke(core.clj:5383)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:401)
at servlet.<clinit>(Unknown Source)
... 76 more
My project.clj file is:
(defproject myproj "0.1"
:description "the sample"
:dependencies [
[org.clojure/clojure "1.3.0"]
[compojure "1.0.4"]
[hiccup "1.0.0"]
[clj-json "0.5.0"]
[ring/ring "1.1.0"]
[clj-http "0.1.1"]
]
:plugins [
[lein-ring "0.7.0"]
]
:ring {:handler routes/start})
If I remove the :ring {:handler routes/start} then I get a NPE somewhere else.
I don't know if I'm missing something in my project.clj, or if the particular version of lein is broken for this use case. Can someone clarify this for me?
I had the same issue, in my case the solution was as simple as doing a
lein clean
before the
lein ring uberwar
I think actual issue is that at some point, my handler was pointing to an incorrect/inexistent handler and that left a servlet.clj in the target/classes directory. Doing a clean will remove this file.
I solved the issue, which was a bit of a mistake on my part. Posting the answer here in case anyone makes the same mistake.
I had something like the following in src/routes.clj:
(defroutes main-routes
(GET "/some/path" [& params] (some-code params))
(route/resources "/")
(route/not-found "not found"))
(def start (run-jetty (handler/site main-routes) {:port 8080}))
This is all standard code to setup routes and provide a hook to start the jetty webapp from the command line via lein ring server-headless. Except that I declared start as a global instead of a function. That means when I run lein ring server-headless things still work, but when I run lein ring uberwar I end up with a weird configuration--a full jetty server will try to start up with it's servlet, AND uberwar has generated a servlet and is trying to package it into a jar.
When I was comparing my code against the compojure examples I kept missing this difference I guess because def and defn optically look so similar. But anyway I just made this change to get it working:
(defn start [] (run-jetty (handler/site main-routes) {:port 8080}))
The error says it all, the :aot param is missing from the project config. Check out this link for using :aot.