[jboss-dev-forums] [Design of JBoss Deployment Framework] - Re: SAR Deployment Deployers Ordering
adrian@jboss.org
do-not-reply at jboss.com
Tue Nov 4 08:15:00 EST 2008
I'm going to reset this conversation in the next post,
but first let me try to summarise the description of this problem
from this long thread and explain what I think is really happening
(and tell you how you would do exactly what you are asking for
although it is the wrong way to do it).
So you can tell me where I have misunderstood .... :-)
You have a sar that contains a war, e.g. like the web-console
| [ejort at warjort management]$ ls -l console-mgr.sar/
| total 1560
| -rw-rw-r-- 1 ejort ejort 142692 Nov 3 20:59 console-mgr-classes.jar
| -rw-rw-r-- 1 ejort ejort 307601 Nov 3 20:59 jcommon.jar
| -rw-rw-r-- 1 ejort ejort 1098048 Nov 3 20:59 jfreechart.jar
| drwxrwxr-x 2 ejort ejort 4096 Nov 3 20:59 META-INF
| drwxrwxr-x 7 ejort ejort 4096 Nov 3 21:00 web-console.war
|
This **naively** means that the webapp in web-console.war needs to be
"deployed" after jbossweb.sar
But if you look at the logging you'll find this isn't what happens in the deployer layer.
This actually hasn't changed in this basic characteristic between jboss4 and jboss5
Since management/console-mgr.sar (the top level deployment name) is before
jbossweb.sar it will go through the deployers first (including all its subdeployments).
ASIDE: What has changed in JBoss5 is that the deployers are now done in stages
so you can be sure the classloader for jbossweb.sar is available in the REAL
stage for all other deployments in deploy.
This makes NoClassDefFoundErrors due to deployment ordering less likely in JBoss5
even when you don't use the new classloading dependencies.
So why isn't this an issue? The answer is that the deployers don't create
the webapp. What they do create is metadata on how to construct the
webapp and what its dependencies are.
i.e. the REAL webapp deployer creates some MBean metadata
that says it depends on the main jboss.web service (Tomcat)
This dependency makes sure that even though the metadata for web-console.war
was created first, the webapp is not constructed until after the webserver is running.
Now what I think is really happening for you and why I think you're seeing a problem
is that you have one of two problems:
1) The webapp (metadata) you are creating is missing a dependency
so the services are being constructed in the wrong order.
2) You are trying to create or access the service in the deployer processing which
you should not be doing.
Finally (and this is not recommended although Ales hinted at in a kind of hacky way)
you can actually make a (sub-)deployment depend on a service.
i.e. deployments can have dependencies even at the deployer stage
The reason this exists is to do classloading dependencies since the later
REAL deployers need to examine classes to create metadata and also
need to redeploy applications (reexamine classes) when dependent classes change.
So if you really want to (not recommended)
make your war subdeployment run after jbossweb
The only way to do this currently is programmatically, i.e. you
do DeploymentUnit.getDependencyInfo().addIDependOn(...)
where the DependencyItem would say that this deployment cannot move
to the REAL stage until the jboss.web MBean reaches the INSTALLED stage.
NOTE: Since deployments as processed as "all or nothing" through the stages
this would actually mean your whole sar doesn't reach the REAL stage
until jboss.web is INSTALLED
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186679#4186679
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186679
More information about the jboss-dev-forums
mailing list