Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Publication Registry stores mapping events from Spring Data Relational #186

Closed
splatter0 opened this issue Apr 27, 2023 · 5 comments
Closed
Assignees
Labels
in: event publication registry Event publication registry type: bug Something isn't working
Milestone

Comments

@splatter0
Copy link

When using spring data jdbc to save entities, the EVENT_PUBLICATION table will save springframework events. Is this normal?
image

@splatter0
Copy link
Author

Caused by: java.lang.IllegalArgumentException: Failed to call setAccess() on Field 'source' (of class java.util.EventObject) due to java.lang.reflect.InaccessibleObjectException, problem: Unable to make field protected transient java.lang.Object java.util.EventObject.source accessible: module java.base does not "opens java.util" to unnamed module @23811a09
at com.fasterxml.jackson.databind.util.ClassUtil.checkAndFixAccess(ClassUtil.java:1008)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.fixAccess(FieldProperty.java:104)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder._fixAccess(BeanDeserializerBuilder.java:535)
... 35 common frames omitted
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field protected transient java.lang.Object java.util.EventObject.source accessible: module java.base does not "opens java.util" to unnamed module @23811a09
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Field.setAccessible(Unknown Source)
at com.fasterxml.jackson.databind.util.ClassUtil.checkAndFixAccess(ClassUtil.java:995)

@Hariharan8Rpc
Copy link

you are trying to use protected fields i guess @xjianyu

@odrotbohm
Copy link
Member

This should only happen if you have an @TransactionalEventListener listening to these events or a super type of them. The default EventSerializer is backed by Jackson and thus only works for event types that are serializable by Jackson out of the box.

In other words, you have to either make sure that there's no transactional event listener listening to those Spring Data-internal events or provide a custom EventSerializer implementation for those types.

@odrotbohm odrotbohm self-assigned this Apr 28, 2023
@odrotbohm odrotbohm added meta: waiting for feedback Waiting for feedback of the original reporter in: event publication registry Event publication registry labels Apr 28, 2023
@odrotbohm odrotbohm changed the title spring-modulith-events support for spring data jdbc Event Publication Registry stores mapping events from Spring Data Relational Apr 29, 2023
@odrotbohm
Copy link
Member

This seems to be caused by spring-projects/spring-framework#30399. I have a fix local to our event multicasting infrastructure available that we can use until the upstream ticket is fixed.

odrotbohm added a commit that referenced this issue Apr 29, 2023
…ractApplicationEventMulticaster.

AbstractApplicationEventMulticaster.supportsEvent(…) currently doesn't properly match unresolved, generic ApplicationEvents (see [0]). We now work around this problem by additionally matching the raw event types in a custom override of supportsEvent(…).

[0] spring-projects/spring-framework#30399
@odrotbohm
Copy link
Member

This should work better now. Please give the latest snapshots a try.

@odrotbohm odrotbohm added this to the 0.6 milestone Apr 30, 2023
@odrotbohm odrotbohm added type: bug Something isn't working and removed meta: waiting for feedback Waiting for feedback of the original reporter labels Apr 30, 2023
odrotbohm added a commit that referenced this issue Apr 30, 2023
…ractApplicationEventMulticaster.

AbstractApplicationEventMulticaster.supportsEvent(…) currently doesn't properly match unresolved, generic ApplicationEvents (see [0]). We now work around this problem by additionally matching the raw event types in a custom override of supportsEvent(…).

[0] spring-projects/spring-framework#30399
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: event publication registry Event publication registry type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants