I've come up with a fix after lots of fiddling, and I cannot quite explain 
it -- but it works!

The component library involves creating records that implement the 
Lifecycle protocol. In every namespace where I implemented that protocol, I 
added a (:gen-class) to the namespace declaration. I also had a *user*namespace 
for development that used required the component library. I moved 
this into the project itself also: (ns user) -> (ns fmspider.user). 
Finally, I switched back and forth between having :clean-non-project-files 
set to true and false -- the only thing that worked was having it set to 
*false*. Every time I build, I always start with "lein clean" to be sure. 

Still not quite sure why it is that things worked this way, or if some 
other combination of the above would yield the same result.

On Friday, April 11, 2014 2:18:27 PM UTC-7, James Reeves wrote:
>
> Clout doesn't depend on any protocols in Clojure. The only protocol it 
> uses is defined within the clout.core namespace itself.
>
> Problems like this are often caused by compiled class files on your 
> classpath. Often they are in the target directory, which can be solved by a 
> "lein clean". The :clean-non-project-files option being set to false in 
> Josh's configuration looks very suspicious!
>
> I've also had problems with class files being accidentally included in the 
> jars of dependencies. In rare cases a dependency may contain class files 
> from other projects, and because class files outrank clj source files, you 
> end up with some pretty bizarre behaviour in such cases.
>
> - James
>
>
> On 11 April 2014 22:09, Tom Connors <t.v.c...@gmail.com <javascript:>>wrote:
>
>> Hi Josh,
>> My solution ended up being pretty lame: I stopped calling a function from 
>> clout, and the uberjar magically worked, as disappointing as that 
>> explanation is. As far as I could tell, the root cause of my problem was 
>> that clout depends on an old version of clojure (1.2, if I recall 
>> correctly) that defined a protocol that no longer exists in newer versions.
>> It doesn't look to me like you're getting the error for the same reason. 
>> Have you tried the standard things, like blow away the target directory and 
>> make sure you've required the ns before using its vars? How about.. and I 
>> hate this idea too... one by one, remove dependencies + code that uses 
>> them, and see if you can get a working jar? 
>> When you do manage to figure this out, please post back here, as I'd like 
>> to understand this error better (it sure is annoying, huh?).
>>
>>
>> On Thursday, February 27, 2014 2:49:38 PM UTC-5, Tom Connors wrote:
>>
>>> Hi Everyone,
>>> I've been having trouble creating an uberjar of a project and I'm hoping 
>>> someone here can point me toward a solution.
>>> After cleaning out the target directory (with "lein clean") and 
>>> preprocessing my cljx, I can run the project with no trouble using lein 
>>> repl and lein run. I can package up the project (lein with-profile prd 
>>> uberjar) and get the resultant jar files. After that, the trouble starts. 
>>> Running the jar (java -jar my-standalone.jar) fails with a 
>>> NoClassDefFoundError error, pointing at a protocol defined in 
>>> weaverjester's clout - 
>>> <https://github.com/weavejester/clout>clout/core/Route. 
>>> I highly doubt clout actually has anything to do with the problem. After 
>>> creating the uberjar, I can no longer run the project with lein run or lein 
>>> repl - I get the same error, and I can't do anything with lein without 
>>> getting that error until I remove the target directory. 
>>> I've inspected the jar and can see that it contains clout, but just 
>>> clout/core.clj - no .class files. I edited clout's project.clj to include 
>>> :aot :all, packaged it into a jar, replaced the clout jar in my local maven 
>>> repo with that new jar, and re-packaged my project. At this point, when I 
>>> ran the jar, I got another NoClassDefFoundError, this time pointing at 
>>> another protocol, but this one from clojure.core: clojure/lang/ILookupHost.
>>> I've been having this problem with the latest leiningen (2.3.4) and 
>>> 2.2.0. 
>>> I've been futzing with my project.clj for some time, but to no avail. 
>>> Any help greatly appreciated.
>>> -Tom
>>>
>>  -- 
>> 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<javascript:>
>> 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 <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to