noir-clojure / noir

A framework for writing web applications in clojure.
http://www.webnoir.org/
738 stars 78 forks source link

Compile issue in 1.3.0-beta10 #119

Closed dbushenko closed 12 years ago

dbushenko commented 12 years ago

Preconditions: Clojure 1.4.0, Leiningen 2.0.0-preview6, jdk1.6 Scenario:

  1. lein new noir mynoir
  2. cd mynoir
  3. change the noir version in project.clj to 1.3.0-beta10
  4. lein run

Result:

Compiling mynoir.server
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64, compiling:(codec.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$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$require.doInvoke(core.clj:5352)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at ring.middleware.params$loading__4505__auto__.invoke(params.clj:1)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337)
    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$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5275)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:604)
    at clojure.core$use.doInvoke(core.clj:5363)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at compojure.handler$loading__4505__auto__.invoke(handler.clj:1)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337)
    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$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$require.doInvoke(core.clj:5352)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at noir.server$loading__4505__auto__.invoke(server.clj:1)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337)
    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$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$require.doInvoke(core.clj:5352)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at mynoir.server$loading__4505__auto__.invoke(server.clj:1)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337)
    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$eval31.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.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64
    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 clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at ring.util.codec$loading__4505__auto__.invoke(codec.clj:1)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337)
    ... 114 more
Compilation failed.
Raynes commented 12 years ago

I'm not able to reproduce this exactly (there is another error due to hiccup changes being incompatible with noir 1.2.1). For what it's worth, the noir template is not currently written for Noir 1.3.0, but for 1.2.1 (which is incompatible with Clojure > 1.2.1). One problem is that hiccup changed some namespaces (in this case page-helpers -> page). I'm not sure what is causing this, but it doesn't happen to me locally. I'll continue to investigate.

dbushenko commented 12 years ago

Well, I think, that this issue has nothing to do with hiccup 1.0. When I run 'lein new noir myapp', it creates an application for noir 1.3.0-beta3. This beta already contains the new hiccup 1.0 and compiles very well. But changing the noir version to beta4 or higher causes the compilation error. That really bothers me since I can't upgrade my projects to the latest noir framework...

Raynes commented 12 years ago

Can you please put together a small sample project that causes this issue and put it on Github for me? I know that's a pain in the butt, but I can't reproduce this locally, so it'd be really helpful! :)

dbushenko commented 12 years ago

Oh, great! Just a moment...

dbushenko commented 12 years ago

Please, get it here: https://docs.google.com/open?id=0BzmL7xzGeOtOcEVCaDFWQnNYVFE Or would you like it as a github repository?

jszakmeister commented 12 years ago

How about as a gist?

Raynes commented 12 years ago

No, this is fine.

Raynes commented 12 years ago

I can't reproduce with this either. lein run works just fine. Can anybody else reproduce with his sample project?

dbushenko commented 12 years ago

Raynes, can you please tell me what's your environment?(especially -- exact leiningen version)

Raynes commented 12 years ago

lein 2. I'm running from a checkout at commit 82d812eccb84b0248bf2873c62d36d8aaa32ddc3. shrug

jszakmeister commented 12 years ago

It runs fine for me too:

:: lein2 run      
All namespaces already :aot compiled.
Starting server...
2012-06-27 01:29:52.158:INFO:oejs.Server:jetty-7.6.1.v20120215
Server started on port [8080].
You can view the site at http://localhost:8080
#<Server org.eclipse.jetty.server.Server@7f2ea1dd>
2012-06-27 01:29:52.203:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080

:: lein2 --version
Leiningen 2.0.0-preview6 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM```

I also follow master on lein, and it runs fine too.

@dbushenko What does your lein classpath look like? Something should be referencing the commons-codec there somewhere:

:: lein classpath | tr : '\n' | grep commons-codec
/Users/jszakmeister/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
dbushenko commented 12 years ago

$ lein classpath | tr : '\n' | grep commons-codec /home/dim/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar

Raynes commented 12 years ago

I'm thoroughly stumped. Maybe delete that file and let maven fetch it again? :\

dbushenko commented 12 years ago

Yeeeey!!! That helped! I have deleted all the common-codec repo and fetched it again and it compiled! Thank you guys, you were very helpful!!

Raynes commented 12 years ago

Great! Happy we got that sorted out. :)