I am attempting to implement a GBean to start up the Open For Business suite of applications. Due to large number of libraries involved we have some tricky ways of loading the application today. Currently we have a small kernel which starts up (much like Geronimo) and dynamically loads all the classes and builds a initial classloader.

From there, using this newly created classloader we startup the server components, i.e. JOTM, Tomcat, etc. We are looking to move away from this approach and instead of embedding these components inside the application, we prefer to run the application inside a container. Specifically Geronimo. Now that OFBiz has been accepted into the Apache Incubator; I am motivated to get this done ASAP.

What I have attempted to do first was just replace the context classload on the current thread of the GBean and used a quick JSR88 implementation to deploy the web applications using this GBean as the parent. However, the classloader obtained (after looking at the GBean source code) is cached on the object itself and appears to be immutable.

My second attempt was based on code I found in the Kernel API. After creating my classloader, I defined a new GBean (from inside the initial GBean which does the classloading). I first grab an instance of the Kernel:

Kernel kernel = KernelRegistry.getSingleKernel();

Then I attempt to:

ObjectName ofb = JMXUtil.getObjectName(":role=OFBizCore");
GBeanData ofbBean = new GBeanData(ofb, OFBLoader.GBEAN_INFO);
kernel.loadGBean(ofbBean, cl);
kernel.startGBean(ofb);

Passing it the classloader *I* created (cl). I was hoping then that if I configured the web applications to have the parent ':role=OFBizCore' in their geronimo-web.xml configuration this would set their servlet context classloader would be a child of the classloader I created (loading the huge amount of classes/libraries required).

However, this bean (ofbBean) remains in the STARTING status and never appears to start.

Can anyone suggest to me a way to accomplish my goal.

1) Load all our classes in a dynamic way. I do not wish to copy all libraries and configuration files into the standard Geronimo repository.

2) Load our web applications from their current location using the classloader from #1. Our web applications are not in a single location and are all expanded.

I am open to suggestions.

Andy

Reply via email to