[jboss-user] [Microcontainer] - Deploying a self contianed JBossMC Bean in a JAR
do-not-reply at jboss.com
Fri Sep 7 08:46:38 EDT 2007
Hi, I'm just getting started with JBoss MC. I've got the most recent source and everything builds locally. From reading these forums and bits of documentation I created a bootstrap that uses the basic bootstrap and then deploys a bootstrap-beans.xml (as is deployed with JBoss AS).
I'm using a cut down version of the bootstrap-beans.xml from JBossAS to bring up my JBossMC, essentially removing anything that is specific to JBossAS.
Now I want to deploy my bean (or even one of the examples) and have it instanced. So I've created a JAR that contains a single simple POJO and a jboss-beans.xml to go in the META-INF directory. The descriptor specifies one bean and points to the simple POJO class in my JAR.
Using my cobbled together bootstrap code I deploy the JAR and observe the following (most of which is expected):
1) The JAR is picked up by the JARStructure and split into it's constituent parts, which are pushed back through the deployment chain.
2) The VFSTopLevelClassLoaderDeployer I have configured reacts to the JAR deployment by created a class loader for the deployed JAR and adding it the deployment context.
3) The jboss-beans.xml gets picked up by the BeanMetaDataDeployer and it creates the bean meta info in and attaches it to the unit
4) The find deployment phase kicks in and attempts to install the bean. At this point I get a ClassNotFoundException for my bean class which fails the deployment.
I'm a bit stuck at this point. Is there an example of a correct configuration for running just the pure JBossMC bean hosting. I assume I'm missing a deployer or something, but I just can't seem to work it out alone. I've checked through the docs/examples but each of those adds the deployed archive containing the beans to the boot classpath, so the classes arn't actually loaded from the deployed artefact at all. Is it not possible to load beans from the archive they're deployed in?
I've spent some time looking through the code. The class loader deployed is creating a basic class loader and storing it in the deployment context. However, I can't find anywhere this context class loader is actually picked up (*the bean deployer seems to use either the bean meta info classloader or the thread context class loader). I've produced a small patch for the DeployersImpl that sets up the context class loader during install - but I'm not sure this is the right approach.
The only other approach I could think of was to deploy a classloader with the bean and have the bean use this - but I haven't been able to determine the correct XML configuration to support this.
Any thoughts or help appreciated,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082131#4082131
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082131
More information about the jboss-user