Intermittent pomegranate problems when running from a checkout #471

Closed
trptcolin opened this Issue Mar 24, 2012 · 4 comments

Comments

3 participants
@trptcolin
Collaborator

trptcolin commented Mar 24, 2012

From time to time (apologies that I haven't yet been able to narrow down further what triggers this), I get errors like the one below when running lein tasks (from this state, any task triggers it, including lein version). URLClasspath is a protocol, so presumable something's looking for that as an interface?

The crazy workaround I found yesterday is to comment out the pomegranate/add-classpath call in leiningen-core/src/leiningen/core/project.clj, line 227. After doing that and re-running, things start working again. Furthermore, when I un-comment that line again, things still work. So it seems like there must be some state sticking around, but thus far I haven't been able to find it and trigger the bad state on purpose.

At any rate, I don't think this should be really high priority since there's a workaround, but it'd be nice to know what's causing this.

Exception in thread "main" java.lang.NoClassDefFoundError: cemerick/pomegranate/URLClasspath
    at leiningen.core.project__init.load(Unknown Source)
    at leiningen.core.project__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at clojure.lang.RT.loadClassForName(RT.java:2030)
    at clojure.lang.RT.load(RT.java:417)
    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:457)
    at leiningen.core.main$loading__4505__auto__.invoke(main.clj:1)
    at leiningen.core.main__init.load(Unknown Source)
    at leiningen.core.main__init.<clinit>(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at clojure.lang.RT.loadClassForName(RT.java:2030)
    at clojure.lang.RT.load(RT.java:417)
    at clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4610.invoke(core.clj:5386)
@xeqi

This comment has been minimized.

Show comment Hide comment
@xeqi

xeqi Mar 24, 2012

Collaborator

I think @technomancy tried to fix this with 352e8d3, however I also see it still happening.

I've found a few workarounds:

  1. rm target/classes/ -r && lein test
  2. removing the :aot #["leiningen"] and removing the target/classes directory will let it work repeatedly with just lein test. I thought I had tried removing the aot line at clojure/west and it failed, but it works for me now.
  3. add $LEIN_DIR/leiningen-core/classes to the classpath setup in bin/lein.

I imagine 3 is the "good" solution for this, but I don't completely understand the interactions with :aot and protocols. https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/r3A1JOIiwVU

Collaborator

xeqi commented Mar 24, 2012

I think @technomancy tried to fix this with 352e8d3, however I also see it still happening.

I've found a few workarounds:

  1. rm target/classes/ -r && lein test
  2. removing the :aot #["leiningen"] and removing the target/classes directory will let it work repeatedly with just lein test. I thought I had tried removing the aot line at clojure/west and it failed, but it works for me now.
  3. add $LEIN_DIR/leiningen-core/classes to the classpath setup in bin/lein.

I imagine 3 is the "good" solution for this, but I don't completely understand the interactions with :aot and protocols. https://groups.google.com/forum/?fromgroups#!topic/clojure-dev/r3A1JOIiwVU

@technomancy

This comment has been minimized.

Show comment Hide comment
@technomancy

technomancy Mar 26, 2012

Owner

Actually I think it's safe to remove all aot from the leiningen-core
library now. If you remove all class files from your checkout you should
be clear now; can you try that?

Owner

technomancy commented Mar 26, 2012

Actually I think it's safe to remove all aot from the leiningen-core
library now. If you remove all class files from your checkout you should
be clear now; can you try that?

@trptcolin

This comment has been minimized.

Show comment Hide comment
@trptcolin

trptcolin Mar 26, 2012

Collaborator

Cool, I'll try that next time I come across this for sure. Unfortunately, I have no solid way of reproducing (phrasing!! http://www.youtube.com/watch?v=VS4QGEQaclk). I was thinking I'd tried that before, but I probably just missed some directory somewhere.

Collaborator

trptcolin commented Mar 26, 2012

Cool, I'll try that next time I come across this for sure. Unfortunately, I have no solid way of reproducing (phrasing!! http://www.youtube.com/watch?v=VS4QGEQaclk). I was thinking I'd tried that before, but I probably just missed some directory somewhere.

@xeqi

This comment has been minimized.

Show comment Hide comment
@xeqi

xeqi Mar 26, 2012

Collaborator

Still broken for me. Reproduction:

  1. ./bin/lein test leiningen.core.test.classpath ; works
  2. ./bin/lein test leiningen.core.test.classpath ; fails

After the first one, leiningen-core gets compiled into target/classes/leiningen/core/, pomegranate does not get compiled, and I get the same error. If I change the :aot regex in project.clj to #"leiningen(?!.core)" then leiningen-core doesn't get compiled and things work.

Collaborator

xeqi commented Mar 26, 2012

Still broken for me. Reproduction:

  1. ./bin/lein test leiningen.core.test.classpath ; works
  2. ./bin/lein test leiningen.core.test.classpath ; fails

After the first one, leiningen-core gets compiled into target/classes/leiningen/core/, pomegranate does not get compiled, and I get the same error. If I change the :aot regex in project.clj to #"leiningen(?!.core)" then leiningen-core doesn't get compiled and things work.

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