-
1. Re: JBoss AS5 and TransactionManager Start Order
alesj Nov 24, 2008 2:58 PM (in response to mwringe)Simple:
You can either re-order top deployments
so that deployment containing TM gets fully deployed before your app deployment.
Problem: not really bullet proof, since, can you really be sure users will not want their own order.
Depending how hard it is to make this deterministic.
Harder:
Programmatically add a dependency on TM for the whole deployment.
e.g. adding some deployer that only recognizes your deployment and adds explicit dependency on TM for deployment unit
Problem: do you know how to implement this? ;-)
Not to worry.
I'll provide you with the Hard:Problem solution,
you just give me exact requirements.
1) How do I recognize your deployment?
e.g.I know it's a Seam deployment since it has one
of the following files in its META-INF: seam.properties, components.xml, ... -
2. Re: JBoss AS5 and TransactionManager Start Order
mwringe Nov 24, 2008 3:13 PM (in response to mwringe)
Harder:
Programmatically add a dependency on TM for the whole deployment.
e.g. adding some deployer that only recognizes your deployment and adds explicit dependency on TM for deployment unit
Problem: do you know how to implement this? ;-)
Yeah, that shouldn't be much of a problem (I am writing up a custom deployer for it anyways).
The bigger issue is that it will affect every sar that uses aop transaction on a class that is also specified as an mbean in the jboss-service.xml file (see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=145746 for more information).
My question on this thread has been was how to get around the transaction manager startup sequence (while waiting for a reply on the other thread about the aop transaction demarcation issues). And I guess the answer to this is to write a custom deployer. -
3. Re: JBoss AS5 and TransactionManager Start Order
alesj Nov 24, 2008 3:49 PM (in response to mwringe)"mwringe" wrote:
The bigger issue is that it will affect every sar that uses aop transaction on a class that is also specified as an mbean in the jboss-service.xml file (see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=145746 for more information).
The you should make this generic. ;-)
As I don't see how else, w/o explicit TM dependency you're gonna handle that aop transactions.
btw: what triggers TM lookup before service is configured?"mwringe" wrote:
My question on this thread has been was how to get around the transaction manager startup sequence (while waiting for a reply on the other thread about the aop transaction demarcation issues). And I guess the answer to this is to write a custom deployer.
I don't understand this.
Or I don't see the issue.
e.g.
1st thread is deploying jbossas deploy directory
2nd thread comes in, but until TM is installed, our app won't be seen/installed
The service should be a subject to transaction/2nd-thread usage until it's installed. -
4. Re: JBoss AS5 and TransactionManager Start Order
mwringe Nov 24, 2008 4:27 PM (in response to mwringe)"alesj" wrote:
"mwringe" wrote:
The bigger issue is that it will affect every sar that uses aop transaction on a class that is also specified as an mbean in the jboss-service.xml file (see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=145746 for more information).
The you should make this generic. ;-)
As I don't see how else, w/o explicit TM dependency you're gonna handle that aop transactions.
well I would explicitly add TM as a dependency if it was possible.
btw: what triggers TM lookup before service is configured?
AOP manipulates the byte code of the class, one of the things it does is to manipulate the constructor so that the first thing it has is a reference to the transaction manager (if the class is specified to want aop transaction demarcation). Mbeans specified in jboss-service.xml are always created before looking at the dependencies.
So if an mbean uses aop transactions, its constructor is called before looking at the dependencies and it crashes because it can't find the transaction manager.
Since this happens in the autogenerated aop manipulations, and this happens before looking at the dependencies specified in the jboss-service.xml, there is nothing that the user can really do about it. [Except create a custom deployer that hacks around the issue (btw, is there a good reference deployer that already does something like this, or am I going to have to create a dummy mbean that requires the TM and have that deployed before the sar)]"alesj" wrote:
"mwringe" wrote:
My question on this thread has been was how to get around the transaction manager startup sequence (while waiting for a reply on the other thread about the aop transaction demarcation issues). And I guess the answer to this is to write a custom deployer.
I don't understand this.
all I was trying to say was that I created this forum thread to figure out how to get the transaction manager to start when I want it too, which the answer I got was to create a custom deployer. My other forum thread was more about how the aop transaction demarcation working properly with the latest AS5 -
5. Re: JBoss AS5 and TransactionManager Start Order
alesj Nov 24, 2008 4:49 PM (in response to mwringe)"mwringe" wrote:
AOP manipulates the byte code of the class, one of the things it does is to manipulate the constructor so that the first thing it has is a reference to the transaction manager (if the class is specified to want aop transaction demarcation). Mbeans specified in jboss-service.xml are always created before looking at the dependencies.
So if an mbean uses aop transactions, its constructor is called before looking at the dependencies and it crashes because it can't find the transaction manager.
Since this happens in the autogenerated aop manipulations, and this happens before looking at the dependencies specified in the jboss-service.xml, there is nothing that the user can really do about it. [Except create a custom deployer that hacks around the issue
This looks like a horrible design,
actually by-passing everything MC stands for. ;-)
Mbeans specified in jboss-service.xml are always created before looking at the dependencies.
So if an mbean uses aop transactions, its constructor is called before looking at the dependencies and it crashes because it can't find the transaction manager.
This should definitely be fixed.
If user has explicit dependencies defined they should be used."mwringe" wrote:
(btw, is there a good reference deployer that already does something like this, or am I going to have to create a dummy mbean that requires the TM and have that deployed before the sar)]
Why would this dummy mbean help? :-)
e.g. your mbean --> TM == your mbean --> dummy --> TM, it's still the same problem ;-)
That's what I said, Hard:Problem is not trivial to implement,
unles you know how VDF (Virtual deployment framework aka our Deployers)
works or you read VDF's reference guide.
Since ref guide doesn't exist, it's the first thing. :-)
But yeah, I'm more then willing to help you if you fight this on your own.
Hint1: MC Deployers project tests are good ref point
Hint2: Deployment == DeploymentControllerContext -;) -
6. Re: JBoss AS5 and TransactionManager Start Order
mwringe Nov 25, 2008 2:37 PM (in response to mwringe)"alesj" wrote:
This looks like a horrible design,
actually by-passing everything MC stands for. ;-)
Mbeans specified in jboss-service.xml are always created before looking at the dependencies.
So if an mbean uses aop transactions, its constructor is called before looking at the dependencies and it crashes because it can't find the transaction manager.
This should definitely be fixed.
If user has explicit dependencies defined they should be used.
Agreed :)
As an additional note, it using pojo's with a jboss-beans.xml file, then you can use 'demands' which will allow you to specify you want that dependency to be started before creating the bean. But demand does not work with jboss-service.xml. -
7. Re: JBoss AS5 and TransactionManager Start Order
alesj Nov 26, 2008 8:10 AM (in response to mwringe)"mwringe" wrote:
As an additional note, it using pojo's with a jboss-beans.xml file, then you can use 'demands' which will allow you to specify you want that dependency to be started before creating the bean. But demand does not work with jboss-service.xml.
You can now use this:
- http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4192453#4192453