[JBoss Seam] - Re: Rollback exceptions without ending the conversation
by enazareno
Hi,
Thanks for pointing that out. Here is my sample code
| @In
| EntityManager em;
|
| @In
| UserList userList;
|
| boolean isnew;
|
| @Out
| User user;
|
| @Begin( id="#{user.id}" )
| public void edit() {
| user = em.merge(userList.getSelectedUser());
| isnew = false;
| }
|
| @End
| public void save() {
| if(isnew)
| em.persist( user );
| else
| em.merge( user );
| userList.refresh(); //can also use event for this
| isnew = false;
| }
|
The conversation actually ends when I press save. However it is my understanding that you cant put a try catch inside the save because the entity manager is flushed only when it ends so at this point there is no error yet? Is this correct? Let's say I'll just accept that limitation and I want to create another conversation instead. I've already specified the conversation id, can't I just use that as a reference to my new conversation that I will create? Or is there no chance to get back to that conversation?
I agree with you, this seems like a complex solution and I'd prefer number one too. It just kinda reminds me of the old days developing Clipper applications where you manage this kind of validation yourself. With client-server development, you are encouraged to let the database handle this. Now its back. Life's a cycle isnt it? so retro :)
Regards,
Elmo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026081#4026081
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026081
19Â years, 1Â month
[JBoss Seam] - Re: Seam & clustering
by holtak
Hello Gavin,
anonymous wrote :
| The use of CONVERSATION-scoped or SESSION-scoped Entity Bean Seam components is not considered truly cluster-safe.
|
| If you need to be cluster safe, hold the reference to the entity bean inside a stateful session bean (in any version of Seam) or inside a JavaBean Seam component that implements Mutable (in Seam 1.1).
|
This means, that if I have an Entity Bean "Item" and use it as
#{item.price} in JSF, I shoud create an SFSB "ItemClusteraware" with getters for Item item = new Item() or em.find(..) from DB (create/edit-feature), remove @Name from Item and use it like this #{itemClusteraware.item.price} in my JSF?
Is that right?
I tried to clusterify my application:
- put "distributable" into web.xml
- anotate Session Beans with @Clustered
- I didn`t do do Entity - SFSB stuff mentioned before, because that would mean lot of refactoring.
Currently I have only one PC with Jboss with the cluster profile, so I deployed there.
The app deployed well and I saw some INFO about TreeCache taking care of SFSB replication.
The app works well too, but just for some period of time. After this period, jboss console output gets polluted with this exception once per second to infinity
ProjectActionImpl is declard like this
| @Stateful
| @Clustered
| @Name("projectAction")
| @CacheConfig(idleTimeoutSeconds=SCRatingDefaults.SFSBTimeout)
| public class ProjectActionImpl implements ProjectAction, Serializable {
|
| 03:42:07,162 INFO [TxInterceptor] There was a problem handling this request
| java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: org.proaut.scrating.ejb3.session.ProjectActionImpl
| at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.prePassivate(LifecycleInterceptorHandler.java:169)
| at org.jboss.ejb3.stateful.StatefulContainer.invokePrePassivate(StatefulContainer.java:382)
| at org.jboss.ejb3.stateful.StatefulBeanContext.prePassivate(StatefulBeanContext.java:178)
| at org.jboss.ejb3.cache.tree.StatefulTreeCache$ClusteredStatefulCacheListener.nodePassivate(StatefulTreeCache.java:288)
| at org.jboss.cache.TreeCache.notifyNodePassivate(TreeCache.java:5739)
| at org.jboss.cache.interceptors.PassivationInterceptor.invoke(PassivationInterceptor.java:62)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:345)
| at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:179)
| at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5520)
| at org.jboss.cache.TreeCache.evict(TreeCache.java:3716)
| at org.jboss.cache.eviction.BaseEvictionPolicy.evict(BaseEvictionPolicy.java:34)
| at org.jboss.cache.eviction.BaseEvictionAlgorithm.evictCacheNode(BaseEvictionAlgorithm.java:210)
| at org.jboss.cache.eviction.BaseEvictionAlgorithm.emptyRecycleQueue(BaseEvictionAlgorithm.java:461)
| at org.jboss.cache.eviction.BaseEvictionAlgorithm.process(BaseEvictionAlgorithm.java:97)
| at org.jboss.cache.eviction.EvictionTimerTask.run(EvictionTimerTask.java:80)
| at java.util.TimerThread.mainLoop(Timer.java:512)
| at java.util.TimerThread.run(Timer.java:462)
| Caused by: java.lang.RuntimeException: java.io.IOException: org.proaut.scrating.ejb3.session.ProjectActionImpl
| at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:367)
| at org.jboss.ejb3.stateful.StatefulBeanContext.getInterceptorInstances(StatefulBeanContext.java:333)
| at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.getLifecycleInvocationContext(LifecycleInvocationContextImpl.java:65)
| at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.prePassivate(LifecycleInterceptorHandler.java:160)
| ... 19 more
| Caused by: java.io.IOException: org.proaut.scrating.ejb3.session.ProjectActionImpl
| at org.jboss.serial.classmetamodel.ClassMetamodelFactory.getClassMetaData(ClassMetamodelFactory.java:332)
| at org.jboss.serial.classmetamodel.StreamingClass.readStream(StreamingClass.java:72)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:381)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:643)
| at org.jboss.serial.persister.ArrayPersister.readObjectArray(ArrayPersister.java:196)
| at org.jboss.serial.persister.ArrayPersister.readData(ArrayPersister.java:172)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:412)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:643)
| at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossObjectInputStream.java:163)
| at java.io.ObjectInputStream.readObject(ObjectInputStream.java:342)
| at org.jboss.serial.io.MarshalledObject.get(MarshalledObject.java:68)
| at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:342)
| at org.jboss.ejb3.stateful.StatefulBeanContext.getInterceptorInstances(StatefulBeanContext.java:333)
| at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.getLifecycleInvocationContext(LifecycleInvocationContextImpl.java:65)
| at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.prePassivate(LifecycleInterceptorHandler.java:160)
| at org.jboss.ejb3.stateful.StatefulContainer.invokePrePassivate(StatefulContainer.java:382)
| at org.jboss.ejb3.stateful.StatefulBeanContext.prePassivate(StatefulBeanContext.java:178)
| at org.jboss.ejb3.cache.tree.StatefulTreeCache$ClusteredStatefulCacheListener.nodePassivate(StatefulTreeCache.java:288)
| at org.jboss.cache.TreeCache.notifyNodePassivate(TreeCache.java:5739)
| at org.jboss.cache.interceptors.PassivationInterceptor.invoke(PassivationInterceptor.java:62)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:345)
| at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:179)
| Caused by: java.lang.ClassNotFoundException: org.proaut.scrating.ejb3.session.ProjectActionImpl
| at java.lang.Class.forName0(Native Method)
| at java.lang.Class.forName(Class.java:242)
| at org.jboss.serial.classmetamodel.ClassMetamodelFactory.resolveClassByName(ClassMetamodelFactory.java:269)
| at org.jboss.serial.classmetamodel.ClassMetamodelFactory.getClassMetaData(ClassMetamodelFactory.java:289)
| at org.jboss.serial.classmetamodel.StreamingClass.readStream(StreamingClass.java:72)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:381)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:643)
| at org.jboss.serial.persister.ArrayPersister.readObjectArray(ArrayPersister.java:196)
| at org.jboss.serial.persister.ArrayPersister.readData(ArrayPersister.java:172)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:412)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:643)
| at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossObjectInputStream.java:163)
| at java.io.ObjectInputStream.readObject(ObjectInputStream.java:342)
| at org.jboss.serial.io.MarshalledObject.get(MarshalledObject.java:68)
| at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:342)
| at org.jboss.ejb3.stateful.StatefulBeanContext.getInterceptorInstances(StatefulBeanContext.java:333)
| at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.getLifecycleInvocationContext(LifecycleInvocationContextImpl.java:65)
| at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.prePassivate(LifecycleInterceptorHandler.java:160)
| at org.jboss.ejb3.stateful.StatefulContainer.invokePrePassivate(StatefulContainer.java:382)
| at org.jboss.ejb3.stateful.StatefulBeanContext.prePassivate(StatefulBeanContext.java:178)
| at org.jboss.ejb3.cache.tree.StatefulTreeCache$ClusteredStatefulCacheListener.nodePassivate(StatefulTreeCache.java:288)
| at org.jboss.cache.TreeCache.notifyNodePassivate(TreeCache.java:5739)
| at org.jboss.cache.interceptors.PassivationInterceptor.invoke(PassivationInterceptor.java:62)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:345)
| at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:156)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:179)
| at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5520)
| at org.jboss.cache.TreeCache.evict(TreeCache.java:3716)
|
the timeout of the SFSB is
public static final int SFSBTimeout=((600*60)+60);
what exactly is going on? it looks like an EJB3 thing but I didn`t find nothing comparable in the EJB3 forum...
thank you,
Juraj Holtak
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026077#4026077
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026077
19Â years, 1Â month