-
1. Re: Deployment dependencies
alesj Feb 2, 2009 9:04 AM (in response to ntsankov)"ntsankov" wrote:
From http://www.jboss.org/community/docs/DOC-13178 looks like that jboss-dependency.xml is the way to do it in JBoss5, but I'm having difficulties understanding the exact usage. Can someone please give more information and also explain the usage of aliases.txt.
The jboss-dependency.xml/item can be read as:
- dependee == the current top deployment unit
- whenRequired == at which state do you require this dependency to be resolved
- dependencyState == in which state should the real dependency be
- the item's value == the actual dependency's name
In case your dependency is a bean,
than this usually has a human readable name,
hence it's easy to express this in item's value; e.g.g TransactionManager
But what about if you depend on another deployment unit? ;-)
e.g. my-very-long-name.ear depends on some-other-even-longer-name.jar
How this deployment units are internally named is impl detail.
Meaning under which name do we keep them in MC's state machine.
You can probably guess or look at the code, but that's *impl* details upon you shouldn't rely on.
And this is where the aliases.txt file kicks in. ;-)
Instead of knowing this impl detail, you put aliases.txt into some-other-even-longer-name.jar/META-INF,
add it some human readable alias, e.g. other123,
and then simply set this as item's dependency value.
OK? -
2. Re: Deployment dependencies
ntsankov Feb 2, 2009 10:00 AM (in response to ntsankov)Thanks Ales, that was helpful :)
I still would like to know what are the possible states for "whenRequired" and "dependencyState" and what are the default values if they are not specified.
FYI I tried the following:
Placed aliases.txt (containing "myejbjar") in the META-INF folder of a jar deploying some ejbs.
Placed jboss-dependency.xml containing:<dependency xmlns="urn:jboss:dependency:1.0"> <item>myejbjar</item> </dependency>
in the META-INF folder of a war deploying a web application using those ejbs.
Note that I have the jar and war exploded in the deploy folder for easier editing.
End result is a NameNotFoundException when the war is deployed before the ejb jar. -
3. Re: Deployment dependencies
alesj Feb 2, 2009 10:42 AM (in response to ntsankov)"ntsankov" wrote:
I still would like to know what are the possible states for "whenRequired" and "dependencyState" and what are the default values if they are not specified.
Possible states:
(they are all possible, but some make sense just for beans or just for deployments)
Beans:addState(ControllerState.NOT_INSTALLED, null); addState(ControllerState.PRE_INSTALL, null); addState(ControllerState.DESCRIBED, null); addState(ControllerState.INSTANTIATED, null); addState(ControllerState.CONFIGURED, null); addState(ControllerState.CREATE, null); addState(ControllerState.START, null); addState(ControllerState.INSTALLED, null);
Deployments:addDeploymentStage(DeploymentStages.NOT_INSTALLED); addDeploymentStage(DeploymentStages.PARSE); addDeploymentStage(DeploymentStages.POST_PARSE); addDeploymentStage(DeploymentStages.PRE_DESCRIBE); addDeploymentStage(DeploymentStages.DESCRIBE); addDeploymentStage(DeploymentStages.CLASSLOADER); addDeploymentStage(DeploymentStages.POST_CLASSLOADER); addDeploymentStage(DeploymentStages.PRE_REAL); addDeploymentStage(DeploymentStages.REAL); addDeploymentStage(DeploymentStages.INSTALLED);
Defaults:
* whenRequired = Described
* dependencyState = Installed"ntsankov" wrote:
End result is a NameNotFoundException when the war is deployed before the ejb jar.
Hmmm ... war should wait for myejbsjar to be Installed.
(deployment's beans/services are triggered at Real state, which is before Installed)
Are those 2 separate deployments? -
4. Re: Deployment dependencies
ntsankov Feb 2, 2009 11:01 AM (in response to ntsankov)Yes, they are. We have several web apps, all depending on those ejbs at servlet/filter init time.
I will further investigate and try to debug this.
A solution would be to package all in a ear file, but that's not possible in our case. -
5. Re: Deployment dependencies
alesj Feb 2, 2009 11:10 AM (in response to ntsankov)"ntsankov" wrote:
I will further investigate and try to debug this.
This are the pieces that create this dependecies (if it helps you with debuging)
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/dependency/ -
6. Re: Deployment dependencies
ntsankov Feb 4, 2009 8:39 AM (in response to ntsankov)Hi again,
What I discovered so far:
jboss-dependency.xml has to be in WEB-INF folder, not in META-INF in order to be discovered inside the webapp.<dependency xmlns="urn:jboss:dependency:1.0"> <item whenRequired="Parse" dependentState="Installed">myejbjar</item> </dependency>
After placing it there I see in the debugger that an AbstractDependencyItem is created for the element I specified with iDependOn set to "myejbjar". Then I placed a conditional breakpoint on the "isResolved()" and "resolve(Controller)" methods of AbstractDependencyItem - condition was"myejbjar".equals(iDependOn)
and I never got a suspend. Any idea? I am currently stuck and would much appreciate some help -
7. Re: Deployment dependencies
alesj Feb 4, 2009 8:54 AM (in response to ntsankov)Ah, yes, WEB-INF for .war's.
Looking only at metadata locations,
which in war's case is WEB-INF, not META-INF.
Your problem is that your whenRequired is already gone. :-)
This dependency building deployer kicks-in past Parse,
hence your dependency is never considered.
Move it up a few states; e.g. Describe