swank-cdt: Using Slime with the Clojure Debugging Toolkit

518 views
Skip to first unread message

George Jahad

unread,
Apr 24, 2011, 7:14:49 PM4/24/11
to Clojure
Swank-cdt is a port of slime/swank-clojure to use the CDT as a
debugger backend.

With swank-cdt, you can step, set breakpoints, catch exceptions, and
eval clojure expressions, in the context of the current stack frame,
from within the sldb buffer.

Install by adding a few lines to your project.clj.

Technomancy has been kind enough to merge it into the main swank-
clojure repo, so it will a part of swank-clojure releases going
forward.

More details here:
http://georgejahad.com/clojure/swank-cdt.html

Devin Walters

unread,
Apr 24, 2011, 7:58:40 PM4/24/11
to clo...@googlegroups.com
Fantastic news. This greatly simplifies the setup process.

Thanks George,
Dw

Sent via mobile

> --
> 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
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Sam Aaron

unread,
Apr 25, 2011, 5:22:19 AM4/25/11
to clo...@googlegroups.com
Hi George,

On 25 Apr 2011, at 00:14, George Jahad wrote:
> Technomancy has been kind enough to merge it into the main swank-
> clojure repo, so it will a part of swank-clojure releases going
> forward.

It's very exciting that CDT is being merged with swank-clojure - great stuff!

I just tried the 1.4.0-SNAPSHOT and ran into issues:

Here's me using a slime REPL:

user> (use 'swank.cdt)
warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail.

No such var: core/swank-worker-thread-name
[Thrown class java.lang.Exception]

Restarts:
0: [QUIT] Quit to the SLIME top level

Backtrace:
0: clojure.lang.Compiler.resolveIn(Compiler.java:5651)
1: clojure.lang.Compiler.resolve(Compiler.java:5621)
2: clojure.lang.Compiler.analyzeSymbol(Compiler.java:5584)
3: clojure.lang.Compiler.analyze(Compiler.java:5172)
4: clojure.lang.Compiler.analyze(Compiler.java:5151)
5: clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3057)
6: clojure.lang.Compiler.analyzeSeq(Compiler.java:5371)
7: clojure.lang.Compiler.analyze(Compiler.java:5190)
8: clojure.lang.Compiler.analyze(Compiler.java:5151)
9: clojure.lang.Compiler$SetExpr.parse(Compiler.java:2546)
10: clojure.lang.Compiler.analyze(Compiler.java:5196)
11: clojure.lang.Compiler.access$100(Compiler.java:35)
12: clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:438)
13: clojure.lang.Compiler.analyzeSeq(Compiler.java:5369)
14: clojure.lang.Compiler.analyze(Compiler.java:5190)
15: clojure.lang.Compiler.analyze(Compiler.java:5151)
16: clojure.lang.Compiler.eval(Compiler.java:5428)
17: clojure.lang.Compiler.load(Compiler.java:5857)
18: clojure.lang.RT.loadResourceScript(RT.java:340)
19: clojure.lang.RT.loadResourceScript(RT.java:331)
20: clojure.lang.RT.load(RT.java:409)
21: clojure.lang.RT.load(RT.java:381)
22: clojure.core$load$fn__4511.invoke(core.clj:4905)
23: clojure.core$load.doInvoke(core.clj:4904)
24: clojure.lang.RestFn.invoke(RestFn.java:409)
25: clojure.core$load_one.invoke(core.clj:4729)
26: clojure.core$load_lib.doInvoke(core.clj:4766)
27: clojure.lang.RestFn.applyTo(RestFn.java:143)
28: clojure.core$apply.invoke(core.clj:542)
29: clojure.core$load_libs.doInvoke(core.clj:4800)
30: clojure.lang.RestFn.applyTo(RestFn.java:138)
31: clojure.core$apply.invoke(core.clj:542)
32: clojure.core$require.doInvoke(core.clj:4869)
33: clojure.lang.RestFn.invoke(RestFn.java:458)
34: swank.core.cdt_backends$eval2627$loading__4410__auto____2628.invoke(cdt_backends.clj:1)
35: swank.core.cdt_backends$eval2627.invoke(cdt_backends.clj:1)
36: clojure.lang.Compiler.eval(Compiler.java:5424)
37: clojure.lang.Compiler.eval(Compiler.java:5415)
38: clojure.lang.Compiler.load(Compiler.java:5857)
39: clojure.lang.RT.loadResourceScript(RT.java:340)
40: clojure.lang.RT.loadResourceScript(RT.java:331)
41: clojure.lang.RT.load(RT.java:409)
42: clojure.lang.RT.load(RT.java:381)
43: clojure.core$load$fn__4511.invoke(core.clj:4905)
44: clojure.core$load.doInvoke(core.clj:4904)
45: clojure.lang.RestFn.invoke(RestFn.java:409)
46: clojure.core$load_one.invoke(core.clj:4729)
47: clojure.core$load_lib.doInvoke(core.clj:4766)
48: clojure.lang.RestFn.applyTo(RestFn.java:143)
49: clojure.core$apply.invoke(core.clj:542)
--more--

I'm using cake which I believe does fancy things with classloaders - perhaps this is causing an issue here too?

Where would be the best place to file a bug report?

Sam

---
http://sam.aaron.name

Jeff Palmucci

unread,
Apr 25, 2011, 10:26:55 AM4/25/11
to clo...@googlegroups.com
I get the same thing with just plain leiningen. It's not cake.

George Jahad

unread,
Apr 25, 2011, 10:41:38 AM4/25/11
to Clojure
strange. haven't seen that one before.

can you and jeff send me your project.clj file, and a directory
listing of your lib and lib/dev directories?

also what operating system/version/java vm are you using?

i'll have to set up a place for bug reports. haven't done so yet.

Sam Aaron

unread,
Apr 25, 2011, 11:38:58 AM4/25/11
to clo...@googlegroups.com
Hi George,

I'm a bit further forward than I was before :-)

On 25 Apr 2011, at 15:41, George Jahad wrote:

> strange. haven't seen that one before.
>
> can you and jeff send me your project.clj file, and a directory
> listing of your lib and lib/dev directories?
>
> also what operating system/version/java vm are you using?

Here's my global cake directory - see that it has pulled in the source and cdt jars (these will be made available to all clojure projects started with cake)

λ tree ~/.cake
/Users/sam/.cake
├── build
├── classes
├── config
├── lib
│ ├── clojure-1.2.0.jar
│ ├── clojure-contrib-1.2.0.jar
│ ├── clojure-source-1.2.0.jar
│ ├── deps.clj
│ └── dev
│ ├── cdt-1.2.6.1-20110417.030036-6.jar
│ ├── debug-repl-0.3.1.jar
│ └── swank-clojure-1.4.0-20110417.030036-3.jar
├── pom.xml
├── project.clj
├── run
└── stable_version

5 directories, 11 files

the global project.clj file that pulled this stuff down is as follows:

(defproject global "0.0.0"
:description "Don't rename this project, but you can change the version if you want."
:dependencies [[clojure "1.2.0"]
[clojure-contrib "1.2.0"]
[clojure-source "1.2.0"]]
:dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]])

I also have a project.clj for a blank project:

(defproject foo "0.0.1-SNAPSHOT"
:description "TODO: add summary of your project"
:dependencies [[clojure "1.2.0"]])

Notice that I don't include either swank-clojure or the jvm opts stuff here - swank-clojure is dealt with by the global project, and cake doesn't seem to honour jvm opts in the project.clj, it asks you to place them in your .cake/config:

jvm.opts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=n

The project lib is also pretty sparse:

λ ls lib
clojure-1.2.0.jar deps.clj

OK, with that all configured, and set up, I start a swank server and try the following:

user> (use 'swank.cdt)
warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail.

Clearing CDT event requests and continuing.
Swank CDT release 1.4.0a started

Notice how this time I'm getting the CDT starting which is further than before - this was because I had forgotten that cake requires the jvm opts in its own config file. I'm also no longer seeing that stack trace.

However, I'm still seeing the tools.jar error - is this a major problem?

Sam

---
http://sam.aaron.name


George Jahad

unread,
Apr 25, 2011, 12:35:41 PM4/25/11
to Clojure

On Apr 25, 8:38 am, Sam Aaron <samaa...@gmail.com> wrote:
> user> (use 'swank.cdt)
> warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail.
> Clearing CDT event requests and continuing.
> Swank CDT release 1.4.0a started
>
> Notice how this time I'm getting the CDT starting which is further than before - this was because I had forgotten that cake requires the jvm opts in its own config file. I'm also no longer seeing that stack trace.
>
> However, I'm still seeing the tools.jar error - is this a major problem?

Can you set breakpoints and catch exceptions per the "test drive" in
the doc?

if so, you should be in business. for my reference, which os/version/
java version are you using?

Also, it sounds like cake setup if significantly different and I don't
know anything about Cake. If you can generalize your setup and send
it to me, I'll add it to the docs.

please keep me posted about any other issues you find!

thanks,
g

Jeff Palmucci

unread,
Apr 25, 2011, 12:58:27 PM4/25/11
to clo...@googlegroups.com
My problem was that I was including incanter, which depends on swank-clojure 1.3.0-snapshot, which was conflicting with 1.4.

I deleted the swank-clojure 1.3 jar from 'lib' and it worked.

Sam Aaron

unread,
Apr 25, 2011, 1:12:38 PM4/25/11
to clo...@googlegroups.com
Hi George,

On 25 Apr 2011, at 17:35, George Jahad wrote:
>
> Can you set breakpoints and catch exceptions per the "test drive" in
> the doc?
>

Sort of. I'm not sure if I'm just doing the wrong things, but when execute

(difference #{1 2} #{2 3})

after setting:

(set-bp clojure.set/difference)

I get a nice buffer popping up:

CDT BreakpointEvent in thread Swank REPL Thread
From here you can: e/eval, v/show source, s/step, x/next, o/exit func

Restarts:
0: [QUIT] Quit to the SLIME top level

Backtrace:
0: clojure.set$difference.invoke(set.clj:48)
1: user$eval3070.invoke(NO_SOURCE_FILE:1)
2: clojure.lang.Compiler.eval(Compiler.java:5424)
3: clojure.lang.Compiler.eval(Compiler.java:5391)
4: clojure.core$eval.invoke(core.clj:2382)
--more--

When I press e the mini buffer prompts me to "Eval in frame:" and I propmpty type s1 to see the following error in the minibuffer:

Unexpected exception generated: java.lang.IllegalArgumentException: Invalid method

This stuff is all new to me, so I'm likely to be doing something silly.

> for my reference, which os/version/
> java version are you using?

λ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)

on OS X 10.6.7

>
> Also, it sounds like cake setup if significantly different and I don't
> know anything about Cake. If you can generalize your setup and send
> it to me, I'll add it to the docs.

I think the version I was describing before was over complicated for a basic 'getting started' doc. I was attempting to get swank-clojure/CDT set up so that it worked on all my projects without needing to explicitly add/change anything. This is clearly something to strive for *after* I've managed to get it working in the simplest case!

Here's a simpler version of the setup:

In a fresh new project (created with `cake new bar`)

I edited the project.clj as follows:

λ cat project.clj
(defproject bar "0.0.1-SNAPSHOT"


:description "TODO: add summary of your project"
:dependencies [[clojure "1.2.0"]]

:dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]
[clojure-source "1.2.0"]])

and created a file called config and placed it in .cake with the following contents:

λ cat .cake/config
jvm.opts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=n

I then pulled the deps with `cake deps`. My lib contains the following:

λ tree lib
lib
├── clojure-1.2.0.jar
├── deps.clj
└── dev
├── cdt-1.2.6.1-20110417.030036-6.jar
├── clojure-source-1.2.0.jar
├── debug-repl-0.3.1.jar
└── swank-clojure-1.4.0-20110417.030036-3.jar

1 directory, 6 files

I can then start swank:

λ cake swank
Listening for transport dt_socket at address: 62404
started swank-clojure server on port 4005

> please keep me posted about any other issues you find!

Will do!

Sam

---
http://sam.aaron.name

Devin Walters

unread,
Apr 25, 2011, 1:59:47 PM4/25/11
to clo...@googlegroups.com
It looks like you've got things pretty well figured out. If you're curious about the general case, #cake.clj on freenode may be of some help.

Phil Hagelberg

unread,
Apr 25, 2011, 2:21:28 PM4/25/11
to Clojure
On Apr 25, 7:26 am, Jeff Palmucci <jpalmu...@gmail.com> wrote:
> I get the same thing with just plain leiningen. It's not cake.

I get this with Leiningen when using a JRE rather than a JDK. You need
to be sure lib/tools.jar exists inside your Java home.

-Phil

George Jahad

unread,
Apr 25, 2011, 2:34:07 PM4/25/11
to Clojure

> When I press e the mini buffer prompts me to "Eval in frame:" and I
> propmpty type s1 to see the following error in the minibuffer:
> Unexpected exception generated: java.lang.IllegalArgumentException:
> Invalid method This stuff is all new to me, so I'm likely to be
> doing something silly.

I doubt that. Most likely you have a fairly complicated installation,
whose problems i haven't experienced yet.

If anyone else has tried this, are you able to eval with the "e" key
from the sldb buffer?

Sam, can I suggest we eliminate those installation issues by
experimenting with a known working project, e.g. logos and seeing if
that works for you?

If so, try this:
git clone https://github.com/swannodette/logos.git

use this project.clj:
(defproject logos "0.6.1-SNAPSHOT"
:description "Logic programming for Clojure"
:dependencies [[org.clojure/clojure "1.3.0-alpha5"]
[org.clojure.contrib/macro-utils "1.3.0-alpha4"]]
:dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]
[clojure-source "1.3.0-alpha5"]
[lein-clojars "0.6.0"]]
:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"]

)

Run lein deps and lein swank
Then try setting a breakpoint.

let me know.

g



Sam Aaron

unread,
Apr 25, 2011, 2:58:28 PM4/25/11
to clo...@googlegroups.com
Hi Phil,


This seems like a very answer indeed.

Sorry if this sounds a bit dumb, but how do I run/use a JDK rather than a JRE. I'm just using a standard mac with developer tools installed (although I assume that has no Java elements these days). Might it already be installed and I'm not using it by default or is there a specific way of installing it?

Running `locate tools.jar` doesn't seem to come up with any hits...

Sam

---
http://sam.aaron.name

Sam Aaron

unread,
Apr 25, 2011, 3:12:41 PM4/25/11
to clo...@googlegroups.com

On 25 Apr 2011, at 19:34, George Jahad wrote:

>
>> When I press e the mini buffer prompts me to "Eval in frame:" and I
>> propmpty type s1 to see the following error in the minibuffer:
>> Unexpected exception generated: java.lang.IllegalArgumentException:
>> Invalid method This stuff is all new to me, so I'm likely to be
>> doing something silly.
>
> I doubt that. Most likely you have a fairly complicated installation,
> whose problems i haven't experienced yet.

That's pretty unlikely unless it is specifically cake that's the issue. I was running in a completely new and empty project with nothing except clojure and swank-clojure as deps.

>
> Sam, can I suggest we eliminate those installation issues by
> experimenting with a known working project, e.g. logos and seeing if
> that works for you?

This seems to work perfectly :-) No tools.jar errors and I can examine the contents of s1 and s2 - Great stuff! This is really exciting :-)

However, if I create a fresh new logos clone, modify the project.clj again, and pull the deps with cake, add the .cake/config jvm.opts line and start a swank server I get the same issues I saw before:

* A tools.jar warning
* An exception when trying to eval s1

I think that this is pretty clearly a cake issue. I do think it would be cool if this worked out of the box with both lein and cake. I like lein, but cake has better native dependency support which I find extremely useful for my projects.

Have any of the cake devs tried the CDT stuff yet? How might I help debug this?

Sam

---
http://sam.aaron.name

lance bradley

unread,
Apr 25, 2011, 11:33:54 PM4/25/11
to Clojure
Hey guys-
I spent some time trying to get this working today. My experiences
mirror Sam's. I'm on a mac, running the jdk that ships with xcode4.
According to
http://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html
, tools.jar does not exist in the xcode jdk. George, are you perhaps
using the openjdk? Once I get this straightened out, I'll confirm that
cake's classloader hanky panky doesn't cause any other issues :)

-lance

George Jahad

unread,
Apr 26, 2011, 12:30:13 AM4/26/11
to Clojure
not using openjdk. and the tools.jar issue is probably a red
herring. i'll try installing cake and see if i can notice anything.
definitely want to keep cake users happy!

On Apr 25, 8:33 pm, lance bradley <lancebrad...@gmail.com> wrote:
> Hey guys-
> I spent some time trying to get this working today. My experiences
> mirror Sam's. I'm on a mac, running the jdk that ships with xcode4.
> According tohttp://developer.apple.com/library/mac/#documentation/Java/Conceptual...

lance bradley

unread,
Apr 26, 2011, 12:41:43 AM4/26/11
to Clojure
I'll keep at it too. Make sure you do a manual checkout and use the
develop branch. I suspected this would be the fix, but I was wrong- it
could still be necessary though:
https://github.com/ninjudd/cake/commit/8d70cb88fd83e6aec17a0dac05e97f5473380e92

Phil Hagelberg

unread,
Apr 26, 2011, 1:22:37 AM4/26/11
to Clojure
On Apr 25, 12:12 pm, Sam Aaron <samaa...@gmail.com> wrote:

> I like lein, but cake has better native dependency support which I find extremely useful for my projects.

I'm curious, what are your requirements for native dependencies?

I have never needed them, so I've relied on contributors and external
plugins because I don't know what's needed. But if it's a blocker for
some it could get merged into Leiningen itself. I've looked at the
plugin and it seems pretty simple. What's missing?

-Phil

Sam Aaron

unread,
Apr 26, 2011, 2:51:20 AM4/26/11
to clo...@googlegroups.com
Hi Phil,

I was originally using lein and the native-deps plugin for my projects, but it's much more cumbersome than cake's approach.

On the periphery it doesn't seem too bad, in your project.clj you need to include native-deps in your :dev-dependencies, and then specify the actual native deps in :native-dependencies as follows:

(defproject org.clojars.samaaron/monome-serial "0.1.3"
:description "An interface to the monome (http://monome.org)"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]]
:dev-dependencies [[native-deps "1.0.5"]]
:native-dependencies [[org.clojars.samaaron/rxtx "2.2.0"]])

Pulling all the deps is a two step process:

* lein deps
* lein native-deps

However, things get more tricky when some of your standard deps have native deps themselves. I had to resort to some hackery to get round this issue: https://github.com/improcess/beatbox/blob/c6e082019e5dad8c7cf37917461339670a38d65f/merge-checkout-deps.rb

With cake things are far, far simpler. There's no need for an extra plugin step, or for you to manually download the native deps of other deps. It is able to determine if a dep contains native deps and does the right thing. So now, the same project's project.clj looks as follows:

(defproject monome-serial "0.2.0"
:description "An interface to the monome (http://monome.org)"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[serial-port "1.0.7"]])


serial-port depends on the rxtx native libs:

(defproject serial-port "1.0.7"
:description "Simple serial port comms library. Wraps RxTx."
:dependencies [[org.clojure/clojure "1.2.0"]
[rxtx22 "1.0.5"]])

and cake deals with it all gracefully. All I need to do is:

cake deps

And cake pulls the correct native libs from all the dependencies and places them in lib/native. It's also smart and only pulls out the correct libs for my architecture.

I hope that this makes sense. It would be awesome if lein followed cake's lead here and did the same thing.

Sam

---
http://sam.aaron.name

Sunil S Nandihalli

unread,
Apr 26, 2011, 11:49:01 AM4/26/11
to clo...@googlegroups.com
integration of cdt with swank is really nice. Thanks for the great work. I tried to set break points at multimethods. but I am unable to do so. Can some body help ?
Thanks,
Sunil.

Phil Hagelberg

unread,
Apr 26, 2011, 12:15:44 PM4/26/11
to Clojure
On Apr 25, 11:51 pm, Sam Aaron <samaa...@gmail.com> wrote:
> I was originally using lein and the native-deps plugin for my projects, but it's much more cumbersome than cake's approach.
>
> On the periphery it doesn't seem too bad, in your project.clj you need to include native-deps in your :dev-dependencies, and then specify the actual native deps in :native-dependencies as follows:
>
> (defproject org.clojars.samaaron/monome-serial "0.1.3"
>   :description "An interface to the monome (http://monome.org)"
>   :dependencies [[org.clojure/clojure "1.2.0"]
>                  [org.clojure/clojure-contrib "1.2.0"]]
>   :dev-dependencies [[native-deps "1.0.5"]]
>   :native-dependencies [[org.clojars.samaaron/rxtx "2.2.0"]])
>
> Pulling all the deps is a two step process:
>
> * lein deps
> * lein native-deps

Hmm; that's silly. I wonder why the plugin works that way. Maybe it
was developed before hooks were added to Leiningen. I think I'll try
to make Leiningen 1.6 work with this stuff built-in.

-Phil

Sam Aaron

unread,
Apr 26, 2011, 1:13:14 PM4/26/11
to clo...@googlegroups.com

That would be outstanding :-)

Sam

---
http://sam.aaron.name

Christian Schuhegger

unread,
Apr 30, 2011, 5:59:55 AM4/30/11
to Clojure
I am using maven directly to work with clojure and I had the problem
with the tools.jar, too. I resolved it by adding the following block
to my pom.xml:

<profiles>
<profile>
<id>default-tools.jar</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>

After that it is still complaining: "warning: unabled to add tools.jar
to classpath. This may cause CDT initialization to fail."
But this does not seem to cause a problem.

Just wanted to share this bit of information with you,
Christian

George Jahad

unread,
Apr 30, 2011, 8:22:46 PM4/30/11
to Clojure
With Lance's help, I've gotten a better understanding of why CDT fails
with Cake. The problem is that Cake makes use of Classlojure,
(https://github.com/ninjudd/classlojure), which allows multiple
versions of clojure to be loaded in the same vm simultaneously. (It's
pretty cool!)

Anyways that breaks certain assumptions that CDT makes about what
classes are loaded; it shouldn't be too hard to fix but will require a
bit of a redesign of cdt, so it will probably be a week or two before
I have a fix available.

Thanks to Lance for helping me understand.

g

On Apr 25, 9:41 pm, lance bradley <lancebrad...@gmail.com> wrote:
> I'll keep at it too. Make sure you do a manual checkout and use the
> develop branch. I suspected this would be the fix, but I was wrong- it
> could still be necessary though:https://github.com/ninjudd/cake/commit/8d70cb88fd83e6aec17a0dac05e97f...

Andreas Liljeqvist

unread,
Aug 5, 2011, 7:34:39 AM8/5/11
to clo...@googlegroups.com
I have problem getting it to work.
Windows 7.
swank-clojure 1.4.0-SNAPSHOT
clojure-mode 1.10.0
lein 1.6.1
GNU Emacs 23.3.1 (i386-mingw-nt6.1.7600) of 2011-03-10 on 3249CTO

project.clj:

(defproject tetris "1.0.0-SNAPSHOT"
  :description "FIXME: write"
  :dependencies [[org.clojure/clojure "1.2.1"]
                 [org.clojure/clojure-contrib "1.2.0"]
[midje "1.1-alpha-1"]]
  :dev-dependencies [[clojure-source "1.2.1"]
                     [swank-clojure "1.4.0-SNAPSHOT"]]
  :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"])

M-x: clojure-jack-in

user> (use 'swank.cdt)
warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail.

com.sun.jdi.Bootstrap
  [Thrown class java.lang.ClassNotFoundException]
...


Manually added tools.jar to classpath.

user> (use 'swank.cdt)
warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail.
CDT  1.4.0a startup failed:  #<IOException java.io.IOException: no providers installed>
nil

Thanks

George Jahad

unread,
Aug 6, 2011, 2:47:03 PM8/6/11
to Clojure
Hey Andreas:
I have heard that it works on Windows, though I've never tried it.
Which jvm are you using?

Also, can you try attaching with command line jdb like so and see if
that gets the "no providers" exception.

1. add a specific port to your jvm options, like 8021 below:
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8021"

2. invoke jdb from the command line with that port, like so:
jdb -attach 8021

3. see if you get any errors
thanks,
g

Andreas Liljeqvist

unread,
Aug 14, 2011, 11:58:56 AM8/14/11
to clo...@googlegroups.com
Hi, sorry for not reporting back.

I did a bit of digging yesterday. Turns out that "sa-jdi.jar" isn't included in JDK6 for windows.
Seems like I must use the sharedmemory connector.

Also it seems that add-classpath doesn't work on windows?

(-> "file:///C:/Program/Java/jdk1.6.0_26/jre/../lib/tools.jar"  java.net.URI. java.io.File. .exists)
true

user> (-> "file:///C:/Program/Java/jdk1.6.0_26/jre/../lib/tools.jar"  add-classpath)
WARNING: add-classpath is deprecated

Context classloader is not a DynamicClassLoader
  [Thrown class java.lang.IllegalAccessError]

Thanks




Andrew

unread,
Dec 6, 2011, 11:51:20 AM12/6/11
to clo...@googlegroups.com
I get the same thing on Windows XP with Leiningen 1.6.2 on Java 1.7.0 Java HotSpot(TM) Client VM
  • copied tools.jar manually to my lib/ just to see if it would work
  • it did, and still gave a warning about tools.jar
  • tried the test drive and when I type v I get this: clojure\set.clj - source not found.
    • tried both clojure 1.2.0 and 1.3.0-alpha5
    • with clojure-source version corresponding to the version of clojure each time

Here's my project.clj file:

(defproject foo "0.0.0-SNAPSHOT"
  :description "project foo"
  :dependencies [[org.clojure/clojure "1.3.0-alpha5"]
                 [seesaw "1.2.2"]]
  :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]
                     [clojure-source "1.3.0-alpha5"]]
  :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"]
  :checksum-deps true)

lib/ contains this:

clojure-1.3.0-alpha5.jar
dev/
filters-2.0.235.jar
forms-1.2.1.jar
j18n-1.0.0.jar
miglayout-3.7.4.jar
seesaw-1.2.2.jar
swing-worker-1.1.jar
swingx-1.6.1.jar
tools.jar

and lib/dev/ contains this:

cdt-1.2.6.2-20111019.122151-1.jar
clojure-1.2.1.jar
clojure-source-1.3.0-alpha5.jar
debug-repl-0.3.1.jar
swank-clojure-1.4.0-20111019.122151-12.jar


I should be able to see the source of set.clj, right?

Sean Corfield

unread,
Dec 6, 2011, 3:48:15 PM12/6/11
to clo...@googlegroups.com
Did you (require 'clojure.set) ? It's not in the instructions for CDT...

Andrew

unread,
Dec 6, 2011, 4:38:18 PM12/6/11
to clo...@googlegroups.com
user> (require 'clojure.set)
nil
user> (set-bp clojure.set/difference)
nil
nil
user> (clojure.set/difference #{1 2} #{2 3})

CDT buffer appears....


CDT BreakpointEvent in thread Swank REPL Thread
From here you can: e/eval, v/show source, s/step, x/next, o/exit func

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: clojure.set$difference.invoke(set.clj:48)
      [No Locals]

If I press v and then go to the *Messageages* buffer, I see this:

Source not found; check @source-path

Sean Corfield

unread,
Dec 6, 2011, 7:36:22 PM12/6/11
to clo...@googlegroups.com
I just created a new project, replaced project.clj with yours, ran
lein deps then lein swank and in Emacs M-x slime-connect. Following
your step below I was able to view the source of set.clj (and all the
compiler Java files as I walked back up the stack).

I know that's not much help but it might help someone else figure out
how/why your env might differ and why you didn't get source...?

(looks like you're on Windows from clojure\set.clj so that might be a
clue to a difference)

Sean

Andrew

unread,
Dec 6, 2011, 10:47:44 PM12/6/11
to clo...@googlegroups.com
Thanks for taking the time Sean! You're right...
  • I'm on Windows XP
  • I had to copy tools.jar to my projects lib manually after lein deps (not sure how to change the classpath)
  • My emacs setup is munged -- I can run M-x eshell but not M-x shell; I have to do lein swank and M-x slime-connect because I can't M-x clojure-jack-in

Young Kim

unread,
Dec 7, 2011, 2:05:15 AM12/7/11
to Clojure
The following is the file lists in clojure-clojure-source-1.3.0-
alpha5.jar on Windows 7.
As you can see, there are no *.clj files in clojure-clojure-
source-1.3.0-alpha5.jar.
So I think that it is natural that 'clojure/set.clj - source not
found.' message appeared.
Do I misunderstand anything?

=====================================================================
C:\work\lab\joy\lib\dev> jar tf clojure-source-1.3.0-alpha5.jar
META-INF/
META-INF/MANIFEST.MF
clojure/
clojure/asm/
clojure/asm/AnnotationVisitor.java
clojure/asm/AnnotationWriter.java
clojure/asm/Attribute.java
clojure/asm/ByteVector.java
clojure/asm/ClassAdapter.java
clojure/asm/ClassReader.java
clojure/asm/ClassVisitor.java
clojure/asm/ClassWriter.java
clojure/asm/commons/
clojure/asm/commons/AdviceAdapter.java
clojure/asm/commons/AnalyzerAdapter.java
clojure/asm/commons/CodeSizeEvaluator.java
clojure/asm/commons/EmptyVisitor.java
clojure/asm/commons/GeneratorAdapter.java
clojure/asm/commons/LocalVariablesSorter.java
clojure/asm/commons/Method.java
clojure/asm/commons/package.html
clojure/asm/commons/SerialVersionUIDAdder.java
clojure/asm/commons/StaticInitMerger.java
clojure/asm/commons/TableSwitchGenerator.java
clojure/asm/Edge.java
clojure/asm/FieldVisitor.java
clojure/asm/FieldWriter.java
clojure/asm/Frame.java
clojure/asm/Handler.java
clojure/asm/Item.java
clojure/asm/Label.java
clojure/asm/MethodAdapter.java
clojure/asm/MethodVisitor.java
clojure/asm/MethodWriter.java
clojure/asm/Opcodes.java
clojure/asm/package.html
clojure/asm/Type.java
clojure/lang/
clojure/lang/AFn.java
clojure/lang/AFunction.java
clojure/lang/Agent.java
clojure/lang/AMapEntry.java
clojure/lang/APersistentMap.java
clojure/lang/APersistentSet.java
clojure/lang/APersistentVector.java
clojure/lang/ARef.java
clojure/lang/AReference.java
clojure/lang/ArityException.java
clojure/lang/ArrayChunk.java
clojure/lang/ArraySeq.java
clojure/lang/ASeq.java
clojure/lang/Associative.java
clojure/lang/Atom.java
clojure/lang/ATransientMap.java
clojure/lang/ATransientSet.java
clojure/lang/BigInt.java
clojure/lang/Binding.java
clojure/lang/Box.java
clojure/lang/ChunkBuffer.java
clojure/lang/ChunkedCons.java
clojure/lang/Compile.java
clojure/lang/Compiler.java
clojure/lang/Compiler.java.orig
clojure/lang/Compiler.java.rej
clojure/lang/Compiler.java~
clojure/lang/Cons.java
clojure/lang/Counted.java
clojure/lang/Delay.java
clojure/lang/DynamicClassLoader.java
clojure/lang/EnumerationSeq.java
clojure/lang/Fn.java
clojure/lang/IChunk.java
clojure/lang/IChunkedSeq.java
clojure/lang/IDeref.java
clojure/lang/IEditableCollection.java
clojure/lang/IFn.java
clojure/lang/IKeywordLookup.java
clojure/lang/ILookup.java
clojure/lang/ILookupSite.java
clojure/lang/ILookupThunk.java
clojure/lang/IMapEntry.java
clojure/lang/IMeta.java
clojure/lang/Indexed.java
clojure/lang/IndexedSeq.java
clojure/lang/IObj.java
clojure/lang/IPersistentCollection.java
clojure/lang/IPersistentList.java
clojure/lang/IPersistentMap.java
clojure/lang/IPersistentSet.java
clojure/lang/IPersistentStack.java
clojure/lang/IPersistentVector.java
clojure/lang/IPromiseImpl.java
clojure/lang/IProxy.java
clojure/lang/IReduce.java
clojure/lang/IRef.java
clojure/lang/IReference.java
clojure/lang/ISeq.java
clojure/lang/IteratorSeq.java
clojure/lang/ITransientAssociative.java
clojure/lang/ITransientCollection.java
clojure/lang/ITransientMap.java
clojure/lang/ITransientSet.java
clojure/lang/ITransientVector.java
clojure/lang/Keyword.java
clojure/lang/KeywordLookupSite.java
clojure/lang/LazilyPersistentVector.java
clojure/lang/LazySeq.java
clojure/lang/LineNumberingPushbackReader.java
clojure/lang/LispReader.java
clojure/lang/LockingTransaction.java
clojure/lang/MapEntry.java
clojure/lang/MapEquivalence.java
clojure/lang/MethodImplCache.java
clojure/lang/MultiFn.java
clojure/lang/Named.java
clojure/lang/Namespace.java
clojure/lang/Numbers.java
clojure/lang/Obj.java
clojure/lang/PersistentArrayMap.java
clojure/lang/PersistentHashMap.java
clojure/lang/PersistentHashSet.java
clojure/lang/PersistentList.java
clojure/lang/PersistentQueue.java
clojure/lang/PersistentStructMap.java
clojure/lang/PersistentTreeMap.java
clojure/lang/PersistentTreeSet.java
clojure/lang/PersistentVector.java
clojure/lang/ProxyHandler.java
clojure/lang/Range.java
clojure/lang/Ratio.java
clojure/lang/Ref.java
clojure/lang/Reflector.java
clojure/lang/Repl.java
clojure/lang/RestFn.java
clojure/lang/Reversible.java
clojure/lang/RT.java
clojure/lang/Script.java
clojure/lang/Seqable.java
clojure/lang/SeqEnumeration.java
clojure/lang/SeqIterator.java
clojure/lang/Sequential.java
clojure/lang/Settable.java
clojure/lang/Sorted.java
clojure/lang/StringSeq.java
clojure/lang/Symbol.java
clojure/lang/TransactionalHashMap.java
clojure/lang/Util.java
clojure/lang/Var.java
clojure/lang/XMLHandler.java
clojure/main.java
============================================================================


On Dec 7, 12:47 pm, Andrew <ache...@gmail.com> wrote:
> Thanks for taking the time Sean! You're right...
>

>    - I'm on Windows XP
>    - I had to copy tools.jar to my projects lib manually after lein deps


>    (not sure how to change the classpath)

>    - My emacs setup is munged -- I can run M-x eshell but not M-x shell; I

Young Kim

unread,
Dec 7, 2011, 5:57:13 AM12/7/11
to Clojure
I posted the related problem on https://github.com/technomancy/swank-clojure/issues/86
Please refer to it! I hope that it will be helpful for you.

On Dec 7, 12:47 pm, Andrew <ache...@gmail.com> wrote:

> Thanks for taking the time Sean! You're right...
>

>    - I'm on Windows XP
>    - I had to copy tools.jar to my projects lib manually after lein deps


>    (not sure how to change the classpath)

>    - My emacs setup is munged -- I can run M-x eshell but not M-x shell; I

George Jahad

unread,
Dec 7, 2011, 1:25:32 PM12/7/11
to Clojure
I think you are right Sean. This is a problem on Windows with the
file separator.

Aravindh Johendran suggested a fix a while ago. Let me try
integrating it and see if that doesn't fix the windows platform.

I'll let you know when I have something.


On Dec 6, 4:36 pm, Sean Corfield <seancorfi...@gmail.com> wrote:

> (looks like you're on Windows from clojure\set.clj so that might be a
> clue to a difference)
>
> Sean
>

George Jahad

unread,
Dec 7, 2011, 1:28:33 PM12/7/11
to Clojure

On Dec 6, 11:05 pm, Young Kim <philo...@gmail.com> wrote:
> The following is the file lists in clojure-clojure-source-1.3.0-
> alpha5.jar on Windows 7.
> As you can see, there are no *.clj files in clojure-clojure-
> source-1.3.0-alpha5.jar.
> So I think that it is natural that 'clojure/set.clj - source not
> found.' message appeared.
> Do I misunderstand anything?
>

Andrew says he is seeing the problem on Clojure 1.2 as well.

George Jahad

unread,
Dec 7, 2011, 1:30:11 PM12/7/11
to Clojure
Thanks very much for this bug report Young!

I'm going to summarize your findings here for everyone else.
Basically, you found 3 problems:

1. The set-bp command requires full name-space qualification of the
function name.

2. On Windows, if attach.dll isn't on the java-library path, you get
the following errors:

on stdout:
java.util.ServiceConfigurationError:
com.sun.tools.attach.spi.AttachProvider: Pr
ovider sun.tools.attach.WindowsAttachProvider could not be
instantiated: java.la
ng.UnsatisfiedLinkError: no attach in java.library.path

at the repl:
CDT 1.4.0a startup failed: #<RuntimeException
java.lang.RuntimeException: java.io.IOException: no providers
installed>


The fix is to add something like the following to your project.clj:

:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"
"-Djava.library.path=C:\\usr\\lang\\java\\jdk\\jre\\bin"]
:extra-classpath-dirs ["C:\\usr\\lang\\java\\jdk\\lib\\tools.jar"]


3. You are seeing a problem with how swank-cdt handles file separators
on
Windows, which may be the same problem reported by Andrew above. I'll
have you try the fix I send him and see if it helps you as well.

Thanks again!


On Dec 7, 2:57 am, Young Kim <philo...@gmail.com> wrote:
> I posted the related problem onhttps://github.com/technomancy/swank-clojure/issues/86

sean neilan

unread,
Feb 29, 2012, 7:00:35 PM2/29/12
to clo...@googlegroups.com
I'm having the same issue on OSX with leiningen.

Unfortunately, it appears the cake project has been taken down so I cannot use it to resolve the tools.jar problem.


The error I'm getting when I do (use 'swank.cdt) can be seen here

http://pastebin.com/Qr1usmDa

sean neilan

unread,
Feb 29, 2012, 8:05:17 PM2/29/12
to clo...@googlegroups.com
I'm sorry, the context of the message was not included. It's a reply to a thread in April 2011.

I have converted to Emacs and am using swank! Hooray!

Now, I want to use swank-cdt but I have this problem.
After installing swank-clojure 1.4.0 with lein, I run (use 'swank.cdt) in a repl and I get this error:
(Ignore line 1 about cake. I don't know how that got there.)

If you search the mailing list for errors with core/swank-worker-thread-name 
It's basically recommended to switch to cake over leiningen but cake doesn't work anymore :(

This is because OSX does not have tools.jar. Instead it has classes.jar. This has something to do with running the JRE instead of the JDK.

Is there anything I can do on OSX Lion to resolve this issue?

Thank you for your time & please excuse my sending this twice. I wanted to provide some context.

--

Sean Corfield

unread,
Feb 29, 2012, 8:50:56 PM2/29/12
to clo...@googlegroups.com
I'm on OS X Lion and using:
* Emacs 24.0.90
* clojure-mode 1.11.4
* lein 1.6.2
* swank-clojure 1.4.0 as a dev-dependency (and as a global plugin, if
it matters)

I start the REPL via M-x clojure-jack-in when viewing my project.clj
file. When I do (use 'swank.cdt) I see the following:

CDT ready
Clearing CDT event requests and continuing.
Swank CDT release 1.5.0a started
nil
user>

And CDT works fine for me...

I do not have tools.jar installed.

Sean

sean neilan

unread,
Feb 29, 2012, 9:10:48 PM2/29/12
to clo...@googlegroups.com
Oh happy day. :)

Adding swank-cdt to dev dependencies solved my problem.

Thank you very much!

Sent from my iPhone

Reply all
Reply to author
Forward
0 new messages