-
1. Re: JBossTransactionServices and WebBeans
alesj Mar 3, 2009 5:48 AM (in response to alesj)"david.allen" wrote:
how to best inject the RealTransactionManager bean into one of our
beans.
I modified webbeans-ejb-jboss-beans.xml to also have the following bean
declaration:<beanfactory name="JBossTransactionServices" class="org.jboss.webbeans.integration.ejb.JBossTransactionServices"> <property name="controller"><inject bean="jboss.kernel:service=KernelController" /></property> <property name="transactionManager"><inject bean="RealTransactionManager" /></property> </beanfactory>
That class/bean just needs the javax.transaction.TransactionManager that
the AS is using.
Add option="callback" attribute to TM's inject.
This will inject your TM once it's available."david.allen" wrote:
However, since this is a deployer perhaps, the TM is not ready or
loaded? I get the following error:
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "JBossTransactionServices" is missing the following
dependencies:
Dependency "RealTransactionManager" (should be in state
"Configured", but is actually in state "** NOT FOUND Depends on
'RealTransactionManager' **")
Yes, the TM is not there yet.
But we do call the checkComplete, which causes this error msg.
We do boot, deployers and deploy in separate steps,
invoking MainDeployer::checkComplete after each of them.
Hence the deployers don't yet see the deploy, which is where the TM is deployed."david.allen" wrote:
I also tried adding a jboss-dependency.xml, but I really do not know
what name to use for the <item> element, or for that matter any of the
attributes. Is this the correct approach?
This wouldn't help either, as what you would actually do is
create a dependency for a whole deployment on a particular bean,
where previously you had a single bean depending on that bean.
The error would be almost the same."david.allen" wrote:
Do you know the exact values
to put into jboss-dependency.xml elements for this case?
Sure, I wrote the jboss-dependency.xml mechanism. :-)
Check its test cases or read more about it here:
- http://www.jboss.org/community/docs/DOC-13178 -
2. Re: JBossTransactionServices and WebBeans
alesj Mar 3, 2009 11:35 AM (in response to alesj)"alesj" wrote:
"david.allen" wrote:
how to best inject the RealTransactionManager bean into one of our
beans.
I modified webbeans-ejb-jboss-beans.xml to also have the following bean
declaration:<beanfactory name="JBossTransactionServices" class="org.jboss.webbeans.integration.ejb.JBossTransactionServices"> <property name="controller"><inject bean="jboss.kernel:service=KernelController" /></property> <property name="transactionManager"><inject bean="RealTransactionManager" /></property> </beanfactory>
That class/bean just needs the javax.transaction.TransactionManager that
the AS is using.
Add option="callback" attribute to TM's inject.
This will inject your TM once it's available.
Unfortunately this won't work with bean factory.
But do you really need bean factory, or is plain bean enough? -
3. Re: JBossTransactionServices and WebBeans
dallen6 Mar 3, 2009 11:49 AM (in response to alesj)I doubt that beanFactory is really needed in this case, but I was following the same pattern as all the other bean factories in that deployer. Ideally, there should just be one bean. The MC integration code is using Java code instead of injection with bean files, so I really do not understand any of it well enough to deviate from the samples already there.
In any event, the error is gone. I still need to check to see if it really injected anything. -
4. Re: JBossTransactionServices and WebBeans
dallen6 Mar 3, 2009 12:05 PM (in response to alesj)The injection does work with option="callback". Maybe it is OK in this case because it is not being used until some later deployment from deploy is actually used after the entire server is started.
-
5. Re: JBossTransactionServices and WebBeans
dallen6 Mar 3, 2009 3:59 PM (in response to alesj)The bean factory was replaced with just the bean. The Java code for the deployer needed to be changed to not define a factory and factory method for this bean via the MC beans SPI.