clj-record jar classpath #2

Closed
y-combinator opened this Issue Aug 14, 2009 · 5 comments

Projects

None yet

2 participants

When I include jar of clj-record into classpath I get "class not found" errors.
Only way for me to get around this issue was to include src dir of clj-record to classpath.

Owner

Could you provide the details of the errors? A stack trace would be ideal. Thanks.

$ git pull origin master
From git://github.com/duelinmarkers/clj-record

  • branch master -> FETCH_HEAD
    Already up-to-date.
    $ ant jar
    Buildfile: build.xml

clean:
[delete] Deleting directory /Users/vladbuslov/opt/clj-record/classes
[delete] Deleting: /Users/vladbuslov/opt/clj-record/clj-record.jar

init:
[mkdir] Created dir: /Users/vladbuslov/opt/clj-record/classes

compile:
[java] Compiling clj-record.boot to classes

jar:
[jar] Building jar: /Users/vladbuslov/opt/clj-record/clj-record.jar

BUILD SUCCESSFUL
Total time: 2 seconds
$ cp clj-record.jar ~/.clojure

Stacktrace in SLIME:
clojure/lang/RT
[Thrown class java.lang.NoClassDefFoundError]

Restarts:
0: [ABORT] Return to SLIME's top level.
1: [CAUSE] Throw cause of this exception

Backtrace:
0: clj_record.boot__init.(Unknown Source)
1: java.lang.Class.forName0(Native Method)
2: java.lang.Class.forName(Class.java:247)
3: clojure.lang.RT.loadClassForName(RT.java:1515)
4: clojure.lang.RT.load(RT.java:389)
5: clojure.lang.RT.load(RT.java:371)
6: clojure.core$load__5833$fn__5836.invoke(core.clj:3888)
7: clojure.core$load__5833.doInvoke(core.clj:3887)
8: clojure.lang.RestFn.invoke(RestFn.java:413)
9: clojure.core$load_one__5785.invoke(core.clj:3724)
10: clojure.core$load_lib__5806.doInvoke(core.clj:3761)
11: clojure.lang.RestFn.applyTo(RestFn.java:147)
12: clojure.core$apply__3948.doInvoke(core.clj:400)
13: clojure.lang.RestFn.invoke(RestFn.java:443)
14: clojure.core$load_libs__5818.doInvoke(core.clj:3787)
15: clojure.lang.RestFn.applyTo(RestFn.java:142)
16: clojure.core$apply__3948.doInvoke(core.clj:400)
17: clojure.lang.RestFn.invoke(RestFn.java:443)
18: clojure.core$require__5824.doInvoke(core.clj:3855)
19: clojure.lang.RestFn.invoke(RestFn.java:441)
20: gst.model.mobile_stat$eval__1683$loading__5715__auto____1685.invoke(NO_SOURCE_FILE:7)
21: gst.model.mobile_stat$eval__1683.invoke(NO_SOURCE_FILE:7)
22: clojure.lang.Compiler.eval(Compiler.java:4601)
23: clojure.lang.Compiler.eval(Compiler.java:4593)
24: clojure.core$eval__4744.invoke(core.clj:1849)
25: swank.commands.basic$eval_region__889.invoke(basic.clj:36)
26: swank.commands.basic$eval__892$interactive_eval_region__894.invoke(basic.clj:41)
27: clojure.lang.Var.invoke(Var.java:359)
28: user$eval__1677.invoke(NO_SOURCE_FILE)
29: clojure.lang.Compiler.eval(Compiler.java:4601)
30: clojure.core$eval__4744.invoke(core.clj:1849)
31: swank.core$eval_in_emacs_package__453.invoke(core.clj:58)
32: swank.core$eval_for_emacs__531.invoke(core.clj:126)
33: clojure.lang.Var.invoke(Var.java:367)
34: clojure.lang.AFn.applyToHelper(AFn.java:179)
35: clojure.lang.Var.applyTo(Var.java:476)
36: clojure.core$apply__3948.doInvoke(core.clj:400)
37: clojure.lang.RestFn.invoke(RestFn.java:428)
38: swank.core$eval_from_control__456.invoke(core.clj:65)
39: swank.core$spawn_worker_thread__554$fn__586$fn__588.invoke(core.clj:168)
40: clojure.lang.AFn.applyToHelper(AFn.java:171)
41: clojure.lang.AFn.applyTo(AFn.java:164)
42: clojure.core$apply__3948.doInvoke(core.clj:400)
43: clojure.lang.RestFn.invoke(RestFn.java:428)
44: swank.core$spawn_worker_thread__554$fn__586.doInvoke(core.clj:164)
45: clojure.lang.RestFn.invoke(RestFn.java:402)
46: clojure.lang.AFn.run(AFn.java:37)
47: java.lang.Thread.run(Thread.java:637)

System.getProperty outputs that clj-record.jar is in classpath. When I change classpath from jar to src dir of clj-record everything works fine.

Owner

If I'm interpreting that stack trace correctly, clj-record.boot is found, and the NoClassDefFound is being thrown from some reference in its static initializer.

To validate that, can you please comment out any other clj-record references in gst.model.mobile_stat so just the require remains, and see that you get the same issue?

Assuming it is the require that's blowing up, I just tested a couple things.

I found that I can require clj-record.boot successfully at a normal repl using the clojure.jar and cojure-contrib.jar from clj-record's lib as well as new builds of the latest of both (though I know the tests aren't compatible with the latest because of test-is moving from contrib into clojure).

I'd like to get swank out of the picture for debugging purposes.

First, from /Users/vladbuslov/opt/clj-record can you please try doing

$ java -cp clj-record.jar:lib/clojure.jar:lib/clojure-contrib.jar clojure.main

and then doing whatever gst.model.mobile_stat does (which seems to be just requiring clj-record.boot)? If that works, then please do the same but referencing the clojure and clojure-contrib jars from your own ~/.clojure directory.

Thanks.

Actually I've compiled cljj-record with my clojure and contrib. Now when trying to compile with jars from clj-record's lib dir I get following error:

$ git pull origin master

From git://github.com/duelinmarkers/clj-record

  • branch master -> FETCH_HEAD
    Already up-to-date.

$ git log

commit 6b2d8b0
Author: John D. Hume duelin.markers@gmail.com
Date: Sat Jul 25 12:25:26 2009 -0500

Docstring additions and edits.

commit 8e2341c
Author: John D. Hume duelin.markers@gmail.com
Date: Thu Jul 23 17:17:06 2009 -0500

TODO convert results lazily

commit f08b599
Author: John D. Hume duelin.markers@gmail.com
Date: Thu Jul 23 17:13:34 2009 -0500

Docs for find-record.

commit 6c3c1b9
Author: John D. Hume duelin.markers@gmail.com
Date: Thu Jul 23 17:11:26 2009 -0500

Move insert down near create.

$ ant jar

Buildfile: build.xml

clean:
[delete] Deleting directory /Users/vladbuslov/opt/clj-record/classes

init:
[mkdir] Created dir: /Users/vladbuslov/opt/clj-record/classes

compile:
[java] Compiling clj-record.boot to classes
[java] Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/AFunction (meta.clj:9)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4493)
[java] at clojure.lang.Compiler.analyze(Compiler.java:4315)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4474)
[java] at clojure.lang.Compiler.analyze(Compiler.java:4315)
[java] at clojure.lang.Compiler.access$100(Compiler.java:35)
[java] at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:367)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4486)
[java] at clojure.lang.Compiler.analyze(Compiler.java:4315)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4474)
[java] at clojure.lang.Compiler.analyze(Compiler.java:4315)
[java] at clojure.lang.Compiler.analyze(Compiler.java:4276)
[java] at clojure.lang.Compiler.compile(Compiler.java:4937)
[java] at clojure.lang.RT.compile(RT.java:353)
[java] at clojure.lang.RT.load(RT.java:392)
[java] at clojure.lang.RT.load(RT.java:366)
[java] at clojure.core$load__5036$fn__5039.invoke(core.clj:3741)
[java] at clojure.core$load__5036.doInvoke(core.clj:3740)
[java] at clojure.lang.RestFn.invoke(RestFn.java:413)
[java] at clojure.core$load_one__4988.invoke(core.clj:3585)
[java] at clojure.core$load_lib__5009.doInvoke(core.clj:3622)
[java] at clojure.lang.RestFn.applyTo(RestFn.java:147)
[java] at clojure.core$apply__3228.doInvoke(core.clj:408)
[java] at clojure.lang.RestFn.invoke(RestFn.java:443)
[java] at clojure.core$load_libs__5021.doInvoke(core.clj:3652)
[java] at clojure.lang.RestFn.applyTo(RestFn.java:142)
[java] at clojure.core$apply__3228.doInvoke(core.clj:408)
[java] at clojure.lang.RestFn.invoke(RestFn.java:460)
[java] at clojure.core$use__5030.doInvoke(core.clj:3718)
[java] at clojure.lang.RestFn.applyTo(RestFn.java:142)
[java] at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2704)
[java] at clojure.lang.Compiler$BodyExpr.eval(Compiler.java:3870)
[java] at clojure.lang.Compiler.compile(Compiler.java:4942)
[java] at clojure.lang.RT.compile(RT.java:353)
[java] at clojure.lang.RT.load(RT.java:392)
[java] at clojure.lang.RT.load(RT.java:366)
[java] at clojure.core$load__5036$fn__5039.invoke(core.clj:3741)
[java] at clojure.core$load__5036.doInvoke(core.clj:3740)
[java] at clojure.lang.RestFn.invoke(RestFn.java:413)
[java] at clojure.core$load_one__4988.invoke(core.clj:3585)
[java] at clojure.core$load_lib__5009.doInvoke(core.clj:3622)
[java] at clojure.lang.RestFn.applyTo(RestFn.java:147)
[java] at clojure.core$apply__3228.doInvoke(core.clj:408)
[java] at clojure.lang.RestFn.invoke(RestFn.java:443)
[java] at clojure.core$load_libs__5021.doInvoke(core.clj:3652)
[java] at clojure.lang.RestFn.applyTo(RestFn.java:142)
[java] at clojure.core$apply__3228.doInvoke(core.clj:408)
[java] at clojure.lang.RestFn.invoke(RestFn.java:443)
[java] at clojure.core$require__5027.doInvoke(core.clj:3708)
[java] at clojure.lang.RestFn.applyTo(RestFn.java:142)
[java] at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2704)
[java] at clojure.lang.Compiler$BodyExpr.eval(Compiler.java:3870)
[java] at clojure.lang.Compiler.compile(Compiler.java:4942)
[java] at clojure.lang.RT.compile(RT.java:353)
[java] at clojure.lang.RT.load(RT.java:392)
[java] at clojure.lang.RT.load(RT.java:366)
[java] at clojure.core$load__5036$fn__5039.invoke(core.clj:3741)
[java] at clojure.core$load__5036.doInvoke(core.clj:3740)
[java] at clojure.lang.RestFn.invoke(RestFn.java:413)
[java] at clojure.core$load_one__4988.invoke(core.clj:3585)
[java] at clojure.core$compile__5043$fn__5045.invoke(core.clj:3751)
[java] at clojure.core$compile__5043.invoke(core.clj:3750)
[java] at clojure.lang.Var.invoke(Var.java:346)
[java] at clojure.lang.Compile.main(Compile.java:56)
[java] Caused by: java.lang.NoClassDefFoundError: clojure/lang/AFunction
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
[java] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[java] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
[java] at java.lang.Class.forName0(Native Method)
[java] at java.lang.Class.forName(Class.java:242)
[java] at clojure.lang.RT.classForName(RT.java:1486)
[java] at clojure.lang.Compiler$FnExpr.getCompiledClass(Compiler.java:3403)
[java] at clojure.lang.Compiler$FnExpr.emit(Compiler.java:3451)
[java] at clojure.lang.Compiler$MethodExpr.emitTypedArgs(Compiler.java:1060)
[java] at clojure.lang.Compiler$StaticMethodExpr.emit(Compiler.java:1321)
[java] at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:3882)
[java] at clojure.lang.Compiler$FnMethod.emit(Compiler.java:3711)
[java] at clojure.lang.Compiler$FnExpr.compile(Compiler.java:3179)
[java] at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2994)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4484)
[java] ... 62 more

BUILD FAILED
/Users/vladbuslov/opt/clj-record/build.xml:31: Java returned: 1

Total time: 1 second

Owner

Closing this issue as the ant build is now replaced with lein.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment