ClassNotFoundException with dynamically compiled classes
Hi all, in my clojure project, I'm working with an external java graph library. Graphs represented by that library conform to a user-specified data model, that is, the graph itself and all its vertices and edges are objects of some java class, which is dynamically generated and compiled when loading such a graph. Now the problem is that I don't have access to these classes but only to the instances. Here's a REPL session: --8---cut here---start-8--- de.uni-koblenz.funtg.test.funtl (def mygraph (load-graph /home/horn/uni/repos/funql/test/greqltestgraph.tg)) #'de.uni-koblenz.funtg.test.funtl/mygraph de.uni-koblenz.funtg.test.funtl mygraph #RouteMapImpl de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl@3e2d015f de.uni-koblenz.funtg.test.funtl (class mygraph) de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl de.uni-koblenz.funtg.test.funtl de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl java.lang.ClassNotFoundException: de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl [Thrown class java.lang.RuntimeException] ; Evaluation aborted. de.uni-koblenz.funtg.test.funtl (Class/forName de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl) de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl [Thrown class java.lang.ClassNotFoundException] ; Evaluation aborted. --8---cut here---end---8--- Why can't I access that class by its qualified name although it's there? Bye, Tassilo -- 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
Re: ClassNotFoundException with dynamically compiled classes
On Wed, Jun 15, 2011 at 6:27 AM, Tassilo Horn tass...@member.fsf.org wrote: Hi all, in my clojure project, I'm working with an external java graph library. Graphs represented by that library conform to a user-specified data model, that is, the graph itself and all its vertices and edges are objects of some java class, which is dynamically generated and compiled when loading such a graph. Now the problem is that I don't have access to these classes but only to the instances. Here's a REPL session: --8---cut here---start-8--- de.uni-koblenz.funtg.test.funtl (def mygraph (load-graph /home/horn/uni/repos/funql/test/greqltestgraph.tg)) #'de.uni-koblenz.funtg.test.funtl/mygraph de.uni-koblenz.funtg.test.funtl mygraph #RouteMapImpl de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl@3e2d015f de.uni-koblenz.funtg.test.funtl (class mygraph) de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl de.uni-koblenz.funtg.test.funtl de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl java.lang.ClassNotFoundException: de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl [Thrown class java.lang.RuntimeException] ; Evaluation aborted. de.uni-koblenz.funtg.test.funtl (Class/forName de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl) de.uni_koblenz.jgralabtest.schemas.greqltestschema.impl.std.RouteMapImpl [Thrown class java.lang.ClassNotFoundException] ; Evaluation aborted. --8---cut here---end---8--- Why can't I access that class by its qualified name although it's there? Perhaps it's not visible to the normal classloader, but it is to some other classloader used by this graph library. Can you not just use (class some-instance) to get ahold of the class object, given you can get ahold of instances as you said, and then use reflection on the class object? -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Re: ClassNotFoundException with dynamically compiled classes
Ken Wesson kwess...@gmail.com writes: Hi Ken, Why can't I access that class by its qualified name although it's there? Perhaps it's not visible to the normal classloader, but it is to some other classloader used by this graph library. Yes, indeed that library uses its own classloader. Can you not just use (class some-instance) to get ahold of the class object, given you can get ahold of instances as you said, and then use reflection on the class object? Yes, that's what I'm currently doing. Bye, Tassilo -- 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