-
1. Custom Deployer - migrate from JBoss4.2
alesj Feb 18, 2011 7:07 AM (in response to gloomy)The question was: how I must use Deployer in JBoss5 (6) for sort and filter subdeployments?
In case you missed this article, a bit more info on how MC' VDF works:
* http://java.dzone.com/articles/jboss-microcontainer-virtual-deployment-framework
To answer the question, you can do this:
(a) use jboss-structure.xml to define a deployment comparator per (sub)deployment
* http://community.jboss.org/wiki/JBoss5custommetadatafiles
A down side of this is that you then have to be explicit about all things; metadata locations, classpath, ...
(b) you can add a deployer that dynamically/runtime sets relative order of subdeployments
* see DeploymentUnitExt::changeRelativeOrder
(c) set global comparator in deployers.xml for MainDeployerImpl
* <property name="comparator"><inject bean="topContextComparator"/></property>
-
2. Custom Deployer - migrate from JBoss4.2
alesj Feb 18, 2011 7:10 AM (in response to gloomy)The question was: how I must use Deployer in JBoss5 (6) for sort and filter subdeployments?
Previous post was about sorting.
What exactly do you wanna filter?
In VDF all deployers touch all (sub)deployments.
It's just a matter of how soon you determine that the given (sub)deployment is not relevant for a deployer.
Hence it's up to a deployer to filter/determine what it needs to process.
e.g. some short circuit logic is prefered, so you don't endup processing all deployments only to realize at the end that there is nothing to process
-
3. Custom Deployer - migrate from JBoss4.2
gloomy Feb 21, 2011 1:41 PM (in response to alesj)Ales Justin wrote:
(b) you can add a deployer that dynamically/runtime sets relative order of subdeployments
* see DeploymentUnitExt::changeRelativeOrder
Thanks for DeploymentUnitExt::changeRelativeOrder !!!
Ales Justin wrote:
determine that the given (sub)deployment is not relevant for a deployerI'm need to determine that given subdeployments is not needed for deployment at all. In JBoss4 I'm just remove such subdeployments from DeploymentInfo.subDeployments and all goes OK.
Example deployment structure:
- some-service.myDeployerExt
- sub-last.jar
- sub-only-need-in-special-case.jar
- sub-second.jar
- sub-first.jar
And I'm need this subdeployments to start in the right order, but sub-only-need-in-special-case.jar is not need to be started at all:
- sub-first.jar
- sub-second.jar
- sub-last.jar
Sorting problem I had already solved (thanks a lot!) but how can I exclude subdeployments from the deployment process at all? I see that task intended to the StructureDeployer, but can't get a right way...
- some-service.myDeployerExt
-
4. Custom Deployer - migrate from JBoss4.2
gloomy Feb 21, 2011 2:14 PM (in response to gloomy)And more... I see DeploymentUnitExt::changeRelativeOrder works only in JBoss6. Is there any "hack" to do such ordering in JBoss5???
-
5. Custom Deployer - migrate from JBoss4.2
alesj Feb 21, 2011 4:43 PM (in response to gloomy)And more... I see DeploymentUnitExt::changeRelativeOrder works only in JBoss6. Is there any "hack" to do such ordering in JBoss5???
I think I ported this feature to MC Deployers 2.0.x as well.
Check if this really exists in 2.0.10.GA version and then simply replace it.
-
6. Custom Deployer - migrate from JBoss4.2
alesj Feb 21, 2011 4:46 PM (in response to gloomy)I'm need to determine that given subdeployments is not needed for deployment at all. In JBoss4 I'm just remove such subdeployments from DeploymentInfo.subDeployments and all goes OK.
Example deployment structure:
- some-service.myDeployerExt
- sub-last.jar
- sub-only-need-in-special-case.jar
- sub-second.jar
- sub-first.jar
And I'm need this subdeployments to start in the right order, but sub-only-need-in-special-case.jar is not need to be started at all:
- sub-first.jar
- sub-second.jar
- sub-last.jar
Sorting problem I had already solved (thanks a lot!) but how can I exclude subdeployments from the deployment process at all? I see that task intended to the StructureDeployer, but can't get a right way...
Simply use jboss-structure.xml, where you explicitly define (sub)deployments.
Or you could add a new StructureDeployer, which would still recognize this sub-deployment,
but would mostly make it a no-op; e.g. no classpath, meta locations, ...
- some-service.myDeployerExt
-
7. Custom Deployer - migrate from JBoss4.2
gloomy Feb 24, 2011 6:58 AM (in response to alesj)I have setted up my Structure Deployer to recognize (return true) some deployments I'm not really need. But JBoss5 returned me a message like that:
14:47:23,704 ERROR [AbstractKernelController] Error installing to PostClassLoader: name=vfsfile:/usr/local/jboss-5.1.0.GA/server/default/deploy/test.onyma/ state=ClassLoader mode=Manual requiredState=PostClassLoader
org.jboss.deployers.spi.DeploymentException: Cannot process metadata
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
...
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: test.TestJob from BaseClassLoader@692a88{ ... }}
at org.jboss.deployers.plugins.annotations.WeakClassLoaderHolder.loadClass(WeakClassLoaderHolder.java:76)
Seems that annotations from this "not need" subdeployments are still recognized by EJBDeployer or some other deployers. How can I tell other deployers not to check "not need" package at all?
-
8. Custom Deployer - migrate from JBoss4.2
alesj Feb 24, 2011 7:50 AM (in response to gloomy)I have setted up my Structure Deployer to recognize (return true) some deployments I'm not really need. But JBoss5 returned me a message like that:
Are you sure you don't have any classpath and metadata location entries setup?
Seems that annotations from this "not need" subdeployments are still recognized by EJBDeployer or some other deployers. How can I tell other deployers not to check "not need" package at all?
* http://java.dzone.com/articles/jboss-microcontainer-scanning