MyFaces CODI and Weld 1.0.1
Hey all, we are currently developing an application based on Weld 1.0.1 and MyFaces CODI. Unfortunately we have some strange problems regarding CODI's @Transactional not always being applied correctly. It seems to be completely ignored in some situations. I've reproduced this problem with Matthias' Modern-EE-JSF2.0 example application. I did just two modifications: 1. Weld doesn't support to inject the EntityManager via @PersistenceContext. So I created a class named EntityManagerProducer to create request scoped EntityManager instances. Then I replaced @PersistenceContext in the DAO with @Inject. This works fine with OpenWebBeans. 2. Then I removed OpenWebBeans and added Weld 1.0.1 to the dependencies. After that @Transactional immediately stopped working. It seems like the TransactionalInterceptor doesn't get invoked at all. No transactions are started and changes to the database aren't persisted any more. You can get the example application here: https://github.com/chkal/modern-ee-app20 Here are the modifications I made to the application: https://github.com/chkal/modern-ee-app20/commits/master Does anyone have an idea what is causing this? I'm not really sure if it is a CODI or a Weld issue. Thanks Christian -- Christian Kaltepoth Blog: http://chkal.blogspot.com/ Twitter: http://twitter.com/chkal
Re: MyFaces CODI and Weld 1.0.1
Hi Christian! The major difference between Weld and OpenWebBeans in the interceptor area is that Weld strictly follows the Bean Definition Archive (BDA) part of the spec. This got added pretty late (in the last few weeks before the spec went final and imo is complete crap [1] ;) In Weld you have to add the interceptors section to ALL jars as well as to the WAR you like to use the interceptor in. Whereas in OWB it is enough to just have it enabled in 1 of the beans.xml files. So please try adding those section to all your beans.xml files and plz report back if that worked out. LieGrue, strub [1] https://issues.jboss.org/browse/CDI-18 --- On Wed, 3/9/11, Christian Kaltepoth christ...@kaltepoth.de wrote: From: Christian Kaltepoth christ...@kaltepoth.de Subject: MyFaces CODI and Weld 1.0.1 To: MyFaces Discussion users@myfaces.apache.org Date: Wednesday, March 9, 2011, 12:31 PM Hey all, we are currently developing an application based on Weld 1.0.1 and MyFaces CODI. Unfortunately we have some strange problems regarding CODI's @Transactional not always being applied correctly. It seems to be completely ignored in some situations. I've reproduced this problem with Matthias' Modern-EE-JSF2.0 example application. I did just two modifications: 1. Weld doesn't support to inject the EntityManager via @PersistenceContext. So I created a class named EntityManagerProducer to create request scoped EntityManager instances. Then I replaced @PersistenceContext in the DAO with @Inject. This works fine with OpenWebBeans. 2. Then I removed OpenWebBeans and added Weld 1.0.1 to the dependencies. After that @Transactional immediately stopped working. It seems like the TransactionalInterceptor doesn't get invoked at all. No transactions are started and changes to the database aren't persisted any more. You can get the example application here: https://github.com/chkal/modern-ee-app20 Here are the modifications I made to the application: https://github.com/chkal/modern-ee-app20/commits/master Does anyone have an idea what is causing this? I'm not really sure if it is a CODI or a Weld issue. Thanks Christian -- Christian Kaltepoth Blog: http://chkal.blogspot.com/ Twitter: http://twitter.com/chkal
Re: MyFaces CODI and Weld 1.0.1
Try to unzip the jar into web-inf/classes and add its beans.xml content to the one in web-inf. This was suggested to my by the glassfish team... :-) sent from my Android phone On Mar 9, 2011 1:31 PM, Christian Kaltepoth christ...@kaltepoth.de wrote: Hey all, we are currently developing an application based on Weld 1.0.1 and MyFaces CODI. Unfortunately we have some strange problems regarding CODI's @Transactional not always being applied correctly. It seems to be completely ignored in some situations. I've reproduced this problem with Matthias' Modern-EE-JSF2.0 example application. I did just two modifications: 1. Weld doesn't support to inject the EntityManager via @PersistenceContext. So I created a class named EntityManagerProducer to create request scoped EntityManager instances. Then I replaced @PersistenceContext in the DAO with @Inject. This works fine with OpenWebBeans. 2. Then I removed OpenWebBeans and added Weld 1.0.1 to the dependencies. After that @Transactional immediately stopped working. It seems like the TransactionalInterceptor doesn't get invoked at all. No transactions are started and changes to the database aren't persisted any more. You can get the example application here: https://github.com/chkal/modern-ee-app20 Here are the modifications I made to the application: https://github.com/chkal/modern-ee-app20/commits/master Does anyone have an idea what is causing this? I'm not really sure if it is a CODI or a Weld issue. Thanks Christian -- Christian Kaltepoth Blog: http://chkal.blogspot.com/ Twitter: http://twitter.com/chkal
Re: MyFaces CODI and Weld 1.0.1
Hi Mark, thank you very much for your response. I've tried your suggestion and it worked great. I didn't knew about the BDA part in the spec and assumed that CODI's beans.xml would globally enable the interceptor. You are right! This BDA stuff is crap! :-) @Matthias: Nice workaround! ;) Thanks Christian 2011/3/9 Mark Struberg strub...@yahoo.de: Hi Christian! The major difference between Weld and OpenWebBeans in the interceptor area is that Weld strictly follows the Bean Definition Archive (BDA) part of the spec. This got added pretty late (in the last few weeks before the spec went final and imo is complete crap [1] ;) In Weld you have to add the interceptors section to ALL jars as well as to the WAR you like to use the interceptor in. Whereas in OWB it is enough to just have it enabled in 1 of the beans.xml files. So please try adding those section to all your beans.xml files and plz report back if that worked out. LieGrue, strub [1] https://issues.jboss.org/browse/CDI-18 --- On Wed, 3/9/11, Christian Kaltepoth christ...@kaltepoth.de wrote: From: Christian Kaltepoth christ...@kaltepoth.de Subject: MyFaces CODI and Weld 1.0.1 To: MyFaces Discussion users@myfaces.apache.org Date: Wednesday, March 9, 2011, 12:31 PM Hey all, we are currently developing an application based on Weld 1.0.1 and MyFaces CODI. Unfortunately we have some strange problems regarding CODI's @Transactional not always being applied correctly. It seems to be completely ignored in some situations. I've reproduced this problem with Matthias' Modern-EE-JSF2.0 example application. I did just two modifications: 1. Weld doesn't support to inject the EntityManager via @PersistenceContext. So I created a class named EntityManagerProducer to create request scoped EntityManager instances. Then I replaced @PersistenceContext in the DAO with @Inject. This works fine with OpenWebBeans. 2. Then I removed OpenWebBeans and added Weld 1.0.1 to the dependencies. After that @Transactional immediately stopped working. It seems like the TransactionalInterceptor doesn't get invoked at all. No transactions are started and changes to the database aren't persisted any more. You can get the example application here: https://github.com/chkal/modern-ee-app20 Here are the modifications I made to the application: https://github.com/chkal/modern-ee-app20/commits/master Does anyone have an idea what is causing this? I'm not really sure if it is a CODI or a Weld issue. Thanks Christian -- Christian Kaltepoth Blog: http://chkal.blogspot.com/ Twitter: http://twitter.com/chkal -- Christian Kaltepoth Blog: http://chkal.blogspot.com/ Twitter: http://twitter.com/chkal
a4j:support and a4j:actionparam
Hi, i have this code: *a4j:region* *h:selectBooleanCheckbox*value=#{subtipo.seleccionado} id=checks disabled=#{VDBean.modoEdicion == false} onchange=call some javascript code *a4j:support* event=onchange status=statustablaSubtipoVisita actionListener=#{VDBean.select} reRender=checks, tablaActividadesVisita * a4j:actionparam assignTo=#{VDBean.foo} value=true id=foo /* /a4j:support /h:selectBooleanCheckbox /a4j:region In the VDBean I have a String foo variable with the get and set methods but when access the foo variable in the VDBean (scope: session) select method it has the initial value false. Why the actionParam do not set the foo variable value?? Can anyone help me? Thanks
Re: a4j:support and a4j:actionparam
I have not used a4j:actionparam, but under richfaces, I have successfully used a4j:support f:setPropertyActionListener target=#{target1} value=#{value1} / f:setPropertyActionListener target=#{target2} value=#{value2} / /a4j:support Perhaps that will do what you need. On Wed, Mar 9, 2011 at 5:32 PM, daniel ccss danielcc...@gmail.com wrote: Hi, i have this code: *a4j:region* *h:selectBooleanCheckbox*value=#{subtipo.seleccionado} id=checks disabled=#{VDBean.modoEdicion == false} onchange=call some javascript code *a4j:support* event=onchange status=statustablaSubtipoVisita actionListener=#{VDBean.select} reRender=checks, tablaActividadesVisita * a4j:actionparam assignTo=#{VDBean.foo} value=true id=foo /* /a4j:support /h:selectBooleanCheckbox /a4j:region In the VDBean I have a String foo variable with the get and set methods but when access the foo variable in the VDBean (scope: session) select method it has the initial value false. Why the actionParam do not set the foo variable value?? Can anyone help me? Thanks
Re: a4j:support and a4j:actionparam
Thanks Myke but I'm using myfaces tomahawk, not richfaces. I also tried a more simple code: In the JSP: h:commandButton value=seleccionar actionListener=#{VisitaDomiciliarBean.seleccionar} id=seleccionarLink style=display:none *f:param name=booleanActividad value=** true/* /h:commandButton In the BackingBean: FacesContext context = FacesContext.getCurrentInstance(); String paramVaule = (String)context.getExternalContext().getRequestParameterMap().get(* booleanActividad*); System.out.println(paramVaule);- null But it returns null, what I'm missing?