users@glassfish.java.net

Re: Loading Classes in at Runtime - NoClassDefFound

From: Sahoo <sahoo_at_sun.com>
Date: Tue, 02 Dec 2008 22:53:28 +0530

Why do you override defineClass? Typically custom class loader authors
have to override findClass and findResource methods. Also, while
constructing your class loader, pass "application class loader" as
delegate by calling appropriate super class constructor.

I should also tell that not many JavaEE server applications define their
own class loaders. They typically use whatever server provides them.

Sahoo

glassfish_at_javadesktop.org wrote:
> Thanks a lot for your reponse! :-)
>
> I understand what you mean in your reply, it makes sense, but I'm just having trouble integrating your suggestion into my code...
>
> In my custom ClassLoader, I make use of the method [i]defineClass(String, byte[], int, int)[/i] to load in my classes. I had to do this because it has protected access so I could only call it from within a subclass. However, I don't know how to call the application classloader's version of "defineClass()", because it has protected access... I don't think I have any alternative than using this defineClass() method either.
>
> Will I still be able to use my custom classloader for this?
>
> Thanks again
> [Message sent by forum member 'calmdownmonkey' (calmdownmonkey)]
>
> http://forums.java.net/jive/thread.jspa?messageID=319587
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>