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