|
| Apache Geronimo > Discussion Forums | User List | Dev List | Wiki | Issue Tracker |
|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Dynamically load jars in running stateHi,
We have an application that we wish to extend its capabilities in running state. I want to load jars into geronimo and make them appear in the classpath so my application can use them without restarting. Is there a way to to this? Best regards, Stig Even Larsen |
|
|
Re: Dynamically load jars in running stateThere is a very Geronimo-specific way with which you can hack with the application classloader.
import org.apache.geronimo.kernel.config.MultiParentClassLoader; ... url = a certain folder or a jar file MultiParentClassLoader cl = (MultiParentClassLoader) Thread.currentThread.getContextClassloader(); cl.addURL(url); ... Good luck. -Jack 2009/6/18 stig larsen <stig@...>
|
|
|
Re: Dynamically load jars in running stateThank you for your swift reply Jack,
I'm also looking into the Gbean and dependency injection, and it seems like it could be done from here aswell? The idea is to insert this extensions (jar file) to the geronimo repository and dynamically load them from there. Is using MultiParentClassLoader the preferred method? Best regards, Stig Even Larsen
|
|
|
Re: Dynamically load jars in running stateA module's gbeans are managed in a "Configuration". One Configuration corresponds to one MultiParentClassLoader instance.All dependencies in deployment plan are added to the classloader as search-paths.
If the dependency is a .car , then the .car's corresponding Configuration's classloader will become a parent classloader of the current classloader. If the dependency is a jar, then the jar's path will become one URL added to the current classloader.
I'm still learning Geronimo. If I make a mistake, pls don't mind.
-- Best Regards, Rodger. |
|
|
Re: Dynamically load jars in running stategood summary :-)
david jencks On Jun 18, 2009, at 4:56 AM, Rodger wrote: > A module's gbeans are managed in a "Configuration". > One Configuration corresponds to one MultiParentClassLoader instance. > All dependencies in deployment plan are added to the classloader as > search-paths. > If the dependency is a .car , then the .car's corresponding > Configuration's classloader will become a parent classloader of the > current classloader. > If the dependency is a jar, then the jar's path will become one URL > added to the current classloader. > > I'm still learning Geronimo. If I make a mistake, pls don't mind. > -- > Best Regards, > Rodger. |
|
|
Re: Dynamically load jars in running stateOn Jun 18, 2009, at 12:33 AM, stig larsen wrote: > > Hi, > > We have an application that we wish to extend its capabilities in > running > state. > I want to load jars into geronimo and make them appear in the > classpath so > my application can use them without restarting. > > Is there a way to to this? As others have pointed out, anything like this is going to be platform specific. Could you describe a bit more what kind of problem you are trying to solve? We might be able to suggest a more appropriate solution than changing the contents of existing classloaders which always seems to me a risky proposition. thanks david jencks > > Best regards, > Stig Even Larsen > -- > View this message in context: http://www.nabble.com/Dynamically-load-jars-in-running-state-tp24087873s134p24087873.html > Sent from the Apache Geronimo - Users mailing list archive at > Nabble.com. > |
|
|
Re: Dynamically load jars in running stateHi David,
This application handles numerous commands, and these are handled in the application. But when a customer wants additional functions/commands we need to add these dynamically without redeploy the application and/or libraries (which are stored in geronimo repository). The commands are defined in an interface which all all commands must address. These commands correspond to a class with the same name, and thus are easy to create if they could be found on the classpath. The question is really if it is possible to add a jar to the geronimo repository and have a running application use it (place the newly repository added jar on the applicaton classpath ) ? I've been looking at gbeans and dependency injection. This could be a solution. Your advice would be appreciated. Best regards, Stig Even Larsen
|
| Free embeddable forum powered by Nabble | Forum Help |
