[EJB/JBoss] - Re: Atomic process in Local SSB -Urgent !!!!!!!
by kahzoo
Can you switch to stateful session bean? If yes, you can try the following:
1. Have the stateful sesion bean class implements javax.ejb.SessionSynchronization interface.
2. Make the database operation transactional, so that in the case of JTA rollback the data is not updated in the DB.
2. Within the afterCompletion() notification method, check the transaction status (which is passed as argument). If it is true (meaning transaction is committed), write your data into the file. Otherwise (meaning rollback), do not write your data into the file.
Please note that this is NOT a perfect solution, because the file operation within the afterCompltion() can fail.
You need to provide good error logging, so that the system admin can later fix the inconsistency manually.
Please check the EJB spec for details.
Hope this helps.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151739#4151739
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151739
18 years, 1 month
[EJB 3.0] - Exception during passivation a stateful session bean
by rockerman
Hi,
I have a problem with an exception during passivation a stateful session bean that only occurs in product environment. The server produces the following stack trace:
| FATAL [org.jboss.serial.persister.RegularObjectPersister] error
| java.lang.reflect.InvocationTargetException
| at sun.reflect.GeneratedMethodAccessor213.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
| at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
| at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
| at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
| at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
| at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
| at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
| at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
| at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
| at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
| at EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList.writeObject(CopyOnWriteArrayList.java:772)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| ......
| ......
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
| at java.util.ArrayList.writeObject(ArrayList.java:570)
| ......
| ......
| Caused by: java.lang.NoClassDefFoundError: org/jaxen/VariableContext
| at java.lang.Class.getDeclaredMethods0(Native Method)
| at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
| at java.lang.Class.getDeclaredMethod(Class.java:1935)
| ......
|
I think the problem is that an instance variable of the session bean (an ArrayList) could not been passivated. I've tried to reproduce the error by setting the 'overager-period' and the 'max-bean-age' properties of the 'Standard Stateful SessionBean' element in the 'standardjboss.xml' file, but as long as we're using EJB 3 I had to configure the 'ejb3-interceptors-aop.xml' file I think. But I'm not sure which properties I have to change to activate an early passivation of the stateful session beans. Does someone have a solution for this?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151735#4151735
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151735
18 years, 1 month