Hi Ted,

Very nice article.

I didn't understand the fine points of this but thought if my user class was
loading a class it should load in the same class loader as loaded my original
class. But apparently it depends on who loaded my original class. All my
classes were managed by Orion.

In JRun it worked fine as
Class.forName("package.class")

In Orion we had change the above since it didn't work-we used the
Beans.instantiate version of
this as I understand it.
Class.forName("package.class", true, this.getClass().getClassLoader())

Does this indicate a problem with Orion's Classloading scheme?

Eric :-)

Ted Neward wrote:

> If you don't want to use Beans, you can always go with
>
> Class.forName("package.class", true, this.getClass().getClassLoader())
>
> However, if you're loaded under the Extension ClassLoader, problems arise
> with this; I wrote a paper on this and how to get around it:
> http://www.javageeks.com/Papers/ClassForName
>
> Orion team: Make sure you get this ClassLoader thing right--BEA/WebLogic
> doesn't, I know for a fact.....
>
> Ted Neward
> Java Instructor, DevelopMentor ( http://www.develop.com )
> http://www.javageeks.com/~tneward
> -----Original Message-----
> From: Eric Richardson <[EMAIL PROTECTED]>
> To: Orion-Interest <[EMAIL PROTECTED]>
> Date: Monday, March 06, 2000 8:12 AM
> Subject: Re: Dynamic class loading in servlet
>
> >Hi,
> >Did you try Beans.instantiate(this.getClass().getClassLoader(),
> >"my.package.Classname") ? This would use the same classloader as servlet
> was
> >loaded in assuming "this" is the servlet? We had to do this going from JRun
> >to Orion and this is a much
> >better way for Servlet 2.2 API.
> >Eric :-)
> >Kit Cragin wrote:
> >
> >> Does anyone know how to load a class at runtime from a servlet within the
> >> Orion environment? I was able to do it using JRun 2.3.3 by getting the
> >> servlet's class loader and instantiating a class based on its name. This
> >> does not seem to work under Orion: I get a ClassNotFoundException.
> >>
> >> Thanks,
> >>
> >> Kit
> >

Reply via email to