> unless the error happens at runtime after a while when you're sure that
> code already got executed and worked, but only errs after a while,
> in which case that would be weird.
That seems to be what happens. I am glad you think it is weird because I
found it very weird.
I am reaching for straws here, but does the namespace change as the code
executes? It occurs to me, in core.clj, when I call a function in another
file, I have some alias introduced via "require":
(:require [clojure.string :as st]
[clojure.pprint :as pp]
[clojure.java.io :as io]
[clojure.java.jdbc :as jdbc]
[clojure.data.json :as json]
[clj-yaml.core :as yaml]
[clj-time.core :as tyme]
[clj-time.format :as tyme-format]
[kiosks-clojure.debugging :as debug]
[kiosks-clojure.memory_display :as mem]
[kiosks-clojure.dates_as_strings :as das]
[kiosks-clojure.update-model :as um]
;; etc
In core, in -main, I start a new thread and call:
(defn persist-data-to-database []
(. java.lang.Thread sleep 180000)
(timbre/spy :debug "in persist-data-to-database: "
(let [converted-document-to-be-persisted
(get-data-to-be-persisted)]
(pd/persist-data-to-database
converted-document-to-be-persisted))))
Maybe I should not have re-used the same function name in 2 spaces. I will
change the name.
I seem to occasionally get this same error with other parts of the code,
always that code outside of core.clj. I really have no clue what is going
on, nor am I sure what my first step should be in debugging this. I am
really clueless about the JVM.
W dniu wtorek, 29 stycznia 2013 02:44:36 UTC-5 użytkownik AtKaaZ napisał:
>
> if not, could it be that the name of some namespace or function
> changed(ie. renamed) but not the call to it? or something along the lines
> of something being renamed but not in all places... unless the error
> happens at runtime after a while when you're sure that code already got
> executed and worked, but only errs after a while, in which case that would
> be weird.
>
>
> On Tue, Jan 29, 2013 at 8:38 AM, AtKaaZ <[email protected] <javascript:>>wrote:
>
>> It might be something like this(pasting here):
>>
>> The problem is the hyphen in the namespace.
>>
>> From the *Joy of Clojure*
>>
>> HYPHENS/UNDERSCORES If you decide to name your namespaces with hyphens, à
>> la my-cool-lib, then the corresponding source file must be named with
>> underscores in place of the hyphens (my_cool_lib.clj).
>>
>> Here is the underlying explanation:
>> http://stackoverflow.com/q/4451693/32174
>>
>> answered Nov 23 '11 at 4:10
>> <http://stackoverflow.com/users/32174/julien-chastang>
>> Julien Chastang <http://stackoverflow.com/users/32174/julien-chastang>
>>
>>
>>
>> On Tue, Jan 29, 2013 at 8:03 AM, larry google groups <
>> [email protected] <javascript:>> wrote:
>>
>>>
>>> Maybe someone can tell me where I went wrong on this one.
>>>
>>> I have an app. Written with Clojure 1.4.
>>>
>>> At first the app was very small, so I put all the code into core.clj.
>>> When I got to about 500 or 600 lines of code, core.clj was too big, so
>>> I started to break it up. There were some string-to-enlive-node
>>> functions that I moved to a file I called
>>> transform_strings_and_nodes.clj.
>>>
>>> The app keeps the most recent 15 minutes worth of session info in
>>> memory, then saves it to the database. Eventually, when this is live,
>>> tourists will arrive and interact with a kiosk and choose an
>>> itinerary. The itinerary is bulky, a lot of HTML strings held in
>>> memory. I began to wonder how bulky this might get. I thought I would
>>> write a profile function, relying on Timbre
>>> https://github.com/ptaoussanis/timbre.
>>>
>>> During development, I would have this function run in a thread and
>>> call itself every 5 minutes. I decided I would hit the app with a lot
>>> of dummy data, and the profile function would do stuff like time how
>>> long it took to transform all the HTML strings in memory into Enlive
>>> nodes.
>>>
>>> This was working for awhile. I am not sure what changed, but now I am
>>> getting:
>>>
>>> Exception in thread "Thread-4" java.lang.NoClassDefFoundError:
>>> kiosks_clojure/transform_strings_and_nodes
>>> $join_all_tourist_itineraries_together$fn__115
>>> at kiosks_clojure.transform_strings_and_nodes
>>>
>>> $join_all_tourist_itineraries_together.invoke(transform_strings_and_nodes.clj:
>>> 84)
>>> at kiosks_clojure.transform_strings_and_nodes
>>>
>>> $render_html_string_to_enlive_nodes.invoke(transform_strings_and_nodes.clj:
>>> 94)
>>> at kiosks_clojure.transform_strings_and_nodes
>>>
>>> $prepare_render_html_string_to_enlive_nodes.invoke(transform_strings_and_nodes.clj:
>>> 101)
>>> at kiosks_clojure.transform_strings_and_nodes
>>>
>>> $profile_render_html_string_to_enlive_nodes.invoke(transform_strings_and_nodes.clj:
>>> 105)
>>> at clojure.lang.AFn.run(AFn.java:24)
>>> at java.lang.Thread.run(Thread.java:722)
>>> Caused by: java.lang.ClassNotFoundException:
>>> kiosks_clojure.transform_strings_and_nodes
>>> $join_all_tourist_itineraries_together$fn__115
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
>>> 308)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>>>
>>>
>>> As far as I can read the stack trace, the exception seems to get
>>> triggered here:
>>>
>>> (defn join-all-tourist-itineraries-together [sessions]
>>> (reduce
>>> (fn [vector-of-tourist-itineraries-as-strings next-tourist-session]
>>> (conj vector-of-tourist-itineraries-as-strings (get-in next-
>>> tourist-session [:itinerary-as-string])))
>>> []
>>> sessions))
>>>
>>>
>>> Which is called from here:
>>>
>>> (defn render-html-string-to-enlive-nodes []
>>> "2013-01-24 - I worry about how slow this might get when the memory
>>> is full of intineraries. I'm going to run these tests while this in
>>> development, to get a sense for what kind of performance we might
>>> get."
>>> (let [sessions (:sessions @um/interactions)
>>> accumulated-total-of-all-tourist-itineraries-in-memory-as-
>>> strings (st/join (join-all-tourist-itineraries-together sessions))
>>> length-of-string-to-be-rendered (.length (str accumulated-
>>> total-of-all-tourist-itineraries-in-memory-as-strings))
>>> itineraries-as-one-string-wrapped-in-div (apply str "<div
>>> id='all-itineraries'>" accumulated-total-of-all-tourist-itineraries-in-
>>> memory-as-strings "</div>")]
>>> (println (apply str "In render-html-string-to-enlive-nodes, the
>>> length of the HTML string: " length-of-string-to-be-rendered))
>>> (transform-html-string-to-enlive-nodes itineraries-as-one-string-
>>> wrapped-in-div (keyword "#all-itineraries"))))
>>>
>>> (defn prepare-render-html-string-to-enlive-nodes []
>>> (p :string-to-enlive-nodes (render-html-string-to-enlive-nodes)))
>>>
>>> (defn profile-render-html-string-to-enlive-nodes []
>>> (. java.lang.Thread sleep 300000)
>>> (profile :debug :summary-render-html-strings-to-enlive-nodes
>>> (prepare-render-html-string-to-enlive-nodes)))
>>>
>>>
>>>
>>> I looked for info about this error and I found this:
>>>
>>>
>>> http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html
>>>
>>> which says:
>>>
>>> "NoClassDefFoundError in Java comes when Java Virtual Machine is not
>>> able to find a particular class at runtime which was available during
>>> compile time. "
>>>
>>>
>>> I am very ignorant of the JVM and I do not understand how this can
>>> happen. Right now, while testing this app, I am compiling it locally
>>> on my Macintosh and I am running it locally on my Macintosh. How can a
>>> class be present at compile time but not at runtime?
>>>
>>>
>>>
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to [email protected]<javascript:>
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> [email protected] <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 [email protected] <javascript:>.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>> --
>> Please correct me if I'm wrong or incomplete,
>> even if you think I'll subconsciously hate it.
>>
>>
>
>
> --
> Please correct me if I'm wrong or incomplete,
> even if you think I'll subconsciously hate it.
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.