I was using defrecord for the first time, to create a type that I wanted to throw+ via slingshot to signal errors from a library.
I'd seen an example of this in another library, and I pretty much just cut and pasted it into my project. I understood that I need to explicitly import the resulting class into clients that use my library, and attempted to do so. When loading the client library that uses and imports, I got this: foo-bar.core.foo-bar-error [Thrown class java.lang.ClassNotFoundException] Restarts: 0: [QUIT] Quit to the SLIME top level Backtrace: 0: java.net.URLClassLoader$1.run(URLClassLoader.java:202) 1: java.security.AccessController.doPrivileged(Native Method) 2: java.net.URLClassLoader.findClass(URLClassLoader.java:190) 3: clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61) 4: java.lang.ClassLoader.loadClass(ClassLoader.java:306) 5: java.lang.ClassLoader.loadClass(ClassLoader.java:247) 6: java.lang.Class.forName0(Native Method) 7: java.lang.Class.forName(Class.java:169) 8: factmigrate.core$eval1645$loading__4414__auto____1646.invoke(core.clj:1) 9: factmigrate.core$eval1645.invoke(core.clj:1) --more-- After a LOT of time and experimentation, I finally realized that in my import statement, I need to replace the hyphen character in my namespace (let's call my namespace foo-bar.core) to an underscore. So in a client of my library, it needs to do something like this (ns foobarclient.core (:use foo-bar.core) (:import foo_bar.core foo-bar-error)) Assuming that somewhere in the foo-bar.core namespace I had done something like this: (defrecord foo-bar-error [blah1 blah2]) I am still recovering from this debugging session, but my current thought is that this was all my fault, and I just need to be smarter about Java interop and naming issues. The hyphen/underscore issue is mentioned here: http://clojure.org/libs Lib Conventions Clojure defines conventions for naming and structuring libs: A lib name is a symbol that will typically contain two or more parts separated by periods. A lib's container is a Java resource whose classpath-relative path is derived from the lib name: The path is a string Periods in the lib name are replaced by slashes in the path Hyphens in the lib name are replaced by underscores in the path But I did not find this right away, and even after I did find it, it was not immediately obvious to me what the implication was in an import statement. So, I simply wanted to document this for the mailing list, in the hope of preventing others from stumbling into this, and maybe if they do, they will find this explanation in their searches… Don -- 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