IncompatibleAggregateException

Hi,

I’m working to run Axon-trader sample using GWT & GWT-Platform but I get the error:

Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/users-context.xml]; nested exception is org.axonframework.eventsourcing.IncompatibleAggregateException: The aggregate [User] does not have a suitable constructor. See Javadoc of GenericEventSourcingRepository for more information.:

java.lang.NoSuchMethodException: com.deskware.gwtp.server.users.command.User.(org.axonframework.domain.AggregateIdentifier)

This is my web.xml and appl-context.xml

<?xml version="1.0" encoding="UTF-8"?>

GWTPAxon

GWTPAxon.html

contextConfigLocation
WEB-INF/spring/*-context.xml

org.springframework.web.context.ContextLoaderListener dispatch org.springframework.web.context.support.HttpRequestHandlerServlet dispatch /dispatch/*
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns=“Index of /schema/beans

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xmlns:context=“Index of /schema/context

xsi:schemaLocation="Index of /schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

Index of /schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

Index of /schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

<context:property-placeholder location=“classpath*:WEB-INF/spring/*.properties” />

<context:component-scan base-package=“com.gwtplatform.dispatch.server.spring” />

<context:annotation-config />

FINEST

Thanks,
Manel

Ensure that you have a constructor that accepts an AggregateIdentifier :

public User(AggregateIdentifier aggregateIdentifier) {
super(aggregateIdentifier);
}

Yes, it is.

It’s the axon-trader sample code and it works fine without GWT & GWT-P.

Thnaks,

El dimecres 19 de setembre de 2012 17:04:58 UTC+2, seamusv va escriure:

Hi Manel,

which version of Axon are you using? In Axon 1, you need a constructor with an “AggregateIdentifier” as parameter. In Axon 2, you need a no-arg constructor. The Axon Trader sample works with Axon 2. So if you’re using the trader as inspiration, while using Axon 1, you get exceptions.

In both versions of Axon, you can override this behavior by implementing the AggregateFactory interface, and providing that to the Repository that you’re using.

Hope this helps. Don’t hesitate to get in touch if you need more help.

Cheers,

Allard Buijze

Hi Allard,

I’m using the original sample code, so axon-2, withput any change in server side.

The original sample runs well. The error appears when using GWTP instead vertx-ui. GWTP needs then appl-context.xml configuration file shown in my first message. I’ve added appl-context.xml file and change web.xml. Those are the only changes I’ve made in server files.

So, the User costructor have a no-arg constuctor: protected User() {}

Thanks for your help!
Manel

2012/9/19 Allard Buijze <buijze@gmail.com>

Hi Manel,

in that case, the error message doesn’t really make sense. The only thing I can think of is that somehow there are Axon 1 libraries on the classpath. The “AggregateIdentifier” that the error message is talking about doesn’t exist in Axon 2 anymore. Only Axon 1 code can generate that error message.

Cheers,

Allard

Allard, you’re right. It was a axon-1.4.jar at war folder.

Sorry and thanks!!

2012/9/21 Allard Buijze <buijze@gmail.com>

Hi Manel,

no problem. I was glad I could help.

Cheers,

Allard