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

ReflectiveMutableCommandProcessingAggregate no method found exceptions on find or loading aggregate with events #10

Open
jltnf54 opened this issue Jun 27, 2018 · 8 comments
Assignees

Comments

@jltnf54
Copy link

jltnf54 commented Jun 27, 2018

The following method fails to call apply on an subclass aggregate.

   @Override
  public T applyEvent(Event event) {
    try {
      getClass().getMethod("apply", event.getClass()).invoke(this, event);
    } catch (InvocationTargetException e) {
      throw new EventuateApplyEventFailedUnexpectedlyException(e.getCause());
    } catch (NoSuchMethodException e) {
      throw new MissingApplyMethodException(e, event);
    } catch (IllegalAccessException e) {
      throw new EventuateApplyEventFailedUnexpectedlyException(e);
    }
    return (T)this;
  }

NoSuchMethodException is thrown when you have:

public void apply(Myevent event) {}

when loading an aggregate or saving and aggregate with previous events.

@cer cer self-assigned this Jun 27, 2018
@cer
Copy link
Collaborator

cer commented Jun 27, 2018

Please explain what you mean by "subclass aggregate"?
What are your hierarchies of aggregate and event classes?

@jltnf54
Copy link
Author

jltnf54 commented Jun 27, 2018

Example:

class MyAgregate extends RefelectiveMutableCommandProcessingAggrgate

And

Interface MyEvent extends Event

@jltnf54
Copy link
Author

jltnf54 commented Jun 27, 2018

It work fine on the initial aggregaterepository.save()

But loading

aggregaterepository.find(identifier)

It fails to retrieve the apply method on the aggregate and cannot be passed to apply(MyEvent) since the signatures do not match, when retrieving the events from eventuate local dB events table

@cer
Copy link
Collaborator

cer commented Jun 27, 2018 via email

@jltnf54
Copy link
Author

jltnf54 commented Jun 27, 2018

no

@jltnf54
Copy link
Author

jltnf54 commented Jun 27, 2018

i can send my maven dependencies.

@jltnf54
Copy link
Author

jltnf54 commented Jun 27, 2018

I think i found the issue. It is spring boot dev tools

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <optional>true</optional>
    </dependency>

once i removed this it works now

@cer
Copy link
Collaborator

cer commented Jun 27, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants