Jar produced with lein uberjar fails on NoClassDefFoundError?

This seems to be a leinigen 1.4.0 bug. You might want to try creating an uberjar with leiningen 1.3.1.

Up vote 4 down vote favorite share g+ share fb share tw.

I have a simple web app with this project. Clj: (defproject squirrel-money "1.0.0-SNAPSHOT" :description "Squirrel Money" :dependencies org. Clojure/clojure "1.2.0" org.

Clojure/clojure-contrib "1.2.0" compojure "0.5.3" ring/ring-jetty-adapter "0.3.5" hiccup "0.3.1" postgresql "8.4-701. Jdbc4" clj-time "0.2.0-SNAPSHOT" :dev-dependencies lein-eclipse "1.0.0" :main squirrel-money. Main :repl-init-script "src/squirrel_money/init_repl.

Clj") My main looks like this: (ns squirrel-money. Main (:gen-class) (:use compojure. Core ring.adapter.

Jetty) (:require compojure. Route :as route squirrel-money. Savings :as savings)) (defn launch routedef (run-jetty routedef {:port 17080})) (defroutes money-routes (GET "/savings" (savings/render)) (route/not-found "Page not found")) (defn -main & args (launch money-routes)) With REPL works just fine.

However, when I generate a jar with lein uberjar and try to execute it as: java -jar squirrel-money-1.0.0-SNAPSHOT-standalone. Jar It dies with this exception: Exception in thread "main" java.lang. NoClassDefFoundError: compojure/response/Renderable at squirrel_money.

Main$fn__1067. Invoke(main. Clj:18) at squirrel_money.

Main__init. Load(Unknown Source) at squirrel_money. Main__init.(Unknown Source) at java.lang.Class.

ForName0(Native Method) at java.lang.Class. ForName(Class. Java:247) at clojure.lang.RT.

LoadClassForName(RT. Java:1578) at clojure.lang.RT. Load(RT.

Java:399) at clojure.lang.RT. Load(RT. Java:381) at clojure.

Core$load$fn__4511. Invoke(core. Clj:4905) at clojure.

Core$load. DoInvoke(core. Clj:4904) at clojure.lang.RestFn.

Invoke(RestFn. Java:409) at clojure.lang.Var. Invoke(Var.

Java:365) at squirrel_money.main.(Unknown Source) Caused by: java.lang. ClassNotFoundException: compojure.response. Renderable at java.net.

URLClassLoader$1. Run(URLClassLoader. Java:202) at java.security.

AccessController. DoPrivileged(Native Method) at java.net.URLClassLoader. FindClass(URLClassLoader.

Java:190) at java.lang.ClassLoader. LoadClass(ClassLoader. Java:307) at sun.misc.

Launcher$AppClassLoader. LoadClass(Launcher. Java:301) at java.lang.ClassLoader.

LoadClass(ClassLoader. Java:248) ... 13 more What am I doing wrong? How to get it to work?

Not sure if that matters, but I noticed that inside the jar my files, clojure itself and Java libs are unpacked as . Class files, while all clojure libs are present only as plain . Clj files.

Clojure compojure leiningen link|improve this question asked Dec 4 '10 at 15:37Konrad Garus7,98321138 80% accept rate.

This seems to be a leinigen 1.4.0 bug. You might want to try creating an uberjar with leiningen 1.3.1. Edit: Leiningen 1.4.0 deletes non-project .

Class files to work around a Clojure bug (see CLJ-322). Apparently this behavior can sometimes cause problems. You can keep leiningen 1.4.0 from deleting non-project .

Class files by setting :keep-non-project-classes to true in your project.clj. See the related leinigen issue for more info.

That works. Thank you! – Konrad Garus Jan 8 '11 at 16:07.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions