Some questions about "addressbook" sample

In this axon sample http://www.axonframework.org/samples/ ,I deploy it in my tomcat,but I can’t find the “Contact” folder in “temp” folder,and when I run this app,add edit or delete address,there always pop up error message:

“java.lang.RuntimeException : java.util.concurrent.ExecutionException: com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.axonframework.sample.app.api.Address as it does not have a no-args constructor : Cannot construct org.axonframework.sample.app.api.Address as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.axonframework.sample.app.api.Address as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.axonframework.sample.app.api.Address as it does not have a no-args constructor
class : org.axonframework.sample.app.api.AddressAddedEvent
required-type : org.axonframework.sample.app.api.Address
path : /org.axonframework.sample.app.api.AddressAddedEvent/address
line number : 1
-------------------------------”

So ,who can help me?thanks!

Hi Jason,

My guess is that you’re either running on a non-Oracle JVM or using jre7. XStream uses a little “magic” on these VM’s to initialize a class. This prevents the use of a default constructor. However, on other JVM’s, in order to intialize a class, XStream must have a default constructor, or the class must implement Serializable. I also noted that (due to its age) the sample is using an old version of XStream. An inspection of the code also shows that the “Address” class implements Serializable. Don’t know why XStream doesn’t want to deserialize it.

If you update the dependency of XStream to 1.4.4 in the “app” module, you should be fine.

Regarding the event store, it seems that the sample is using a JPA Event Store with an in-memory database (hsqldb). So unfortunately, the description on the samples page doesn’t correspond with the actual configuration of the sample.

It’s probably time do decommission this example. It’s quite out-dated and too simplistic for a proper sample. A more interesting example is the Axon Trader (https://github.com/AxonFramework/Axon-trader). It’s not entirely finished, but does illustrate the use of Axon better.

Cheers,

Allard

Jason,

I have updated the sample to use the latest version of Axon and XStream, as well as the filesystem event store. You can download it from the samples page: http://www.axonframework.org/samples/

Cheers,

Allard