Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Implemeting postMerge events
Implemeting postMerge events [message #907971] Tue, 04 September 2012 13:50 Go to next message
Amit B is currently offline Amit BFriend
Messages: 14
Registered: July 2012
Junior Member
Hi,
Getting a crash when trying to implement post merge event. My application defines a custom annotation to maintain a cache on the client side. The application is also implementing a post merge event so that some transient data in each entity can be merge post persist or post merge calls. The event listener class is defines using the annotation @EntityListeners(value = {MyEventListener.class}) for each of the entities. When the application calls getAnnotation() method on the same entity to get the custom annotation the client crashes with the stack trace shown below -
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at sun.reflect.annotation.AnnotationParser.parseClassArray(Unknown Source)
	at sun.reflect.annotation.AnnotationParser.parseArray(Unknown Source)
	at sun.reflect.annotation.AnnotationParser.parseMemberValue(Unknown Source)
	at sun.reflect.annotation.AnnotationParser.parseAnnotation(Unknown Source)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(Unknown Source)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations(Unknown Source)
	at java.lang.Class.initAnnotationsIfNecessary(Unknown Source)
	at java.lang.Class.getAnnotation(Unknown Source)
	at com.easyautomation.feedoffice.FOEDataCache.initializeInternalListeners(FOEDataCache.java:34)
	at com.easyautomation.DataCache.<init>(DataCache.java:20)
	at com.easyautomation.feedoffice.FOEDataCache.<init>(FOEDataCache.java:16)
	at com.easyautomation.feedoffice.ClientDataCache.<init>(ClientDataCache.java:163)
	at com.easyautomation.feedoffice.ClientDataCache.<clinit>(ClientDataCache.java:171)
	at com.easyautomation.feedoffice.forms.FOENumericTextFieldFactory.<init>(FOENumericTextFieldFactory.java:14)
	at com.easyautomation.feedoffice.forms.FOENumericTextFieldFactory.getInstance(FOENumericTextFieldFactory.java:24)
	at com.easyautomation.feedoffice.FOEApplet.displayMenu(FOEApplet.java:282)
	at com.easyautomation.feedoffice.FOEApplet.loginWindowClosed(FOEApplet.java:215)
	at com.easyautomation.feedoffice.forms.AppLogin.submitButtonClicked(AppLogin.java:49)
	at com.easyautomation.feedoffice.forms.AppLogin.performSubmitAction(AppLogin.java:106)
	at com.easyautomation.forms.TitledInternalFrame$2.actionPerformed(TitledInternalFrame.java:88)
	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
	at javax.swing.JComponent.processKeyBinding(Unknown Source)
	at javax.swing.JComponent.processKeyBindings(Unknown Source)
	at javax.swing.JComponent.processKeyEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Note that this crash only happens when I define the @EntityListeners. If I comment this out everything works fine. It looks an issue with reflection. Is their any other jar file besides eclipselink and jpa 2.0 that needs to be included to implement postmerge events ?. Any help is appreciated.

Thanks
Re: Implemeting postMerge events [message #909043 is a reply to message #907971] Thu, 06 September 2012 13:01 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

It sounds like you are missing the persistence.jar or eclipselink.jar from your client's classpath.


James : Wiki : Book : Blog : Twitter
Re: Implemeting postMerge events [message #909639 is a reply to message #909043] Fri, 07 September 2012 13:14 Go to previous messageGo to next message
Amit B is currently offline Amit BFriend
Messages: 14
Registered: July 2012
Junior Member
James Thanks. I tried adding the jar files to my CLASSPATH but didn't help. The strange thing is that, the problem does not happen when I run the client through the debugger. Only happens outside the debugger. Also, there are other annotations like @Entity, @Table, @NamedQueries that have had no issues with the custom annotation @MMyCacheUpdate. Only after I add the @EntityListeners(value = {MyEventListener.class}) the crash happens. What can be different about @EntityListner that only that does not work while all others do.

Thanks.
Re: Implemeting postMerge events [message #915672 is a reply to message #907971] Mon, 17 September 2012 18:18 Go to previous messageGo to next message
Amit B is currently offline Amit BFriend
Messages: 14
Registered: July 2012
Junior Member
Still haven't found a solution for this issue.
Re: Implemeting postMerge events [message #915724 is a reply to message #915672] Mon, 17 September 2012 21:08 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Try checking the classloader within FOEDataCache.initializeInternalListeners and see if you can load the classes involved directly - both the MyEventListener and the EntityListeners annotation.
Re: Implemeting postMerge events [message #939163 is a reply to message #915724] Wed, 10 October 2012 13:36 Go to previous message
Amit B is currently offline Amit BFriend
Messages: 14
Registered: July 2012
Junior Member
Could not get the EntityListeners annotation to work. However in-case someone has the same issue, I worked around the problem and did a postMerge. The other solution that worked is to detach the entity by using detach or try the entitymanager clear method, and then for a find and refresh of entity from the table. In-case shared cache is turned on you may also need to evict(). Thanks.
Previous Topic:OneToMany is not working using composite key in JPA2.0 with Ecliselink
Next Topic:MultiTenancy/Inheritance: Strange NPE
Goto Forum:
  


Current Time: Thu Apr 18 21:02:09 GMT 2024

Powered by FUDForum. Page generated in 0.02654 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top