question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Event storage engines cannot be used without XStream

See original GitHub issue

Basic information

  • Axon Framework version: 4.6.0
  • JDK version: 11

Steps to reproduce

Create a simple Spring Boot Application using the axon-spring-boot-starter with excluded XStream:

<dependency>
	<groupId>org.axonframework</groupId>
	<artifactId>axon-spring-boot-starter</artifactId>
	<version>4.6.0</version>
	<exclusions>
		<exclusion>
			<groupId>org.axonframework</groupId>
			<artifactId>axon-server-connector</artifactId>
		</exclusion>
		<exclusion>
			<groupId>com.thoughtworks.xstream</groupId>
			<artifactId>xstream</artifactId>
		</exclusion>
	</exclusions>
</dependency>

Make sure that all serializers are set to jackson:

axon.serializer.general=jackson
axon.serializer.events=jackson
axon.serializer.messages=jackson

Expected behaviour

The application starts.

Actual behaviour

The application crashes due to a missing class.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘eventStorageEngine’ defined in class path resource [org/axonframework/springboot/autoconfig/JpaEventStoreAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.axonframework.eventsourcing.eventstore.EventStorageEngine]: Factory method ‘eventStorageEngine’ threw exception; nested exception is java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.22.jar:5.3.22] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.22.jar:5.3.22] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.3.jar:2.7.3] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.3.jar:2.7.3] at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.3.jar:2.7.3] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.3.jar:2.7.3] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.3.jar:2.7.3] at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.axonframework.eventsourcing.eventstore.EventStorageEngine]: Factory method ‘eventStorageEngine’ threw exception; nested exception is java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.22.jar:5.3.22] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.22.jar:5.3.22] … 18 common frames omitted Caused by: java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver at org.axonframework.eventsourcing.eventstore.jpa.JpaEventStorageEngine.builder(JpaEventStorageEngine.java:133) ~[axon-eventsourcing-4.6.0.jar:4.6.0] at org.axonframework.springboot.autoconfig.JpaEventStoreAutoConfiguration.eventStorageEngine(JpaEventStoreAutoConfiguration.java:58) ~[axon-spring-boot-autoconfigure-4.6.0.jar:4.6.0] at org.axonframework.springboot.autoconfig.JpaEventStoreAutoConfiguration$$EnhancerBySpringCGLIB$$26dca9f1.CGLIB$eventStorageEngine$0(<generated>) ~[axon-spring-boot-autoconfigure-4.6.0.jar:4.6.0] at org.axonframework.springboot.autoconfig.JpaEventStoreAutoConfiguration$$EnhancerBySpringCGLIB$$26dca9f1$$FastClassBySpringCGLIB$$425bb5fc.invoke(<generated>) ~[axon-spring-boot-autoconfigure-4.6.0.jar:4.6.0] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.22.jar:5.3.22] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.22.jar:5.3.22] at org.axonframework.springboot.autoconfig.JpaEventStoreAutoConfiguration$$EnhancerBySpringCGLIB$$26dca9f1.eventStorageEngine(<generated>) ~[axon-spring-boot-autoconfigure-4.6.0.jar:4.6.0] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.22.jar:5.3.22] … 19 common frames omitted Caused by: java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na] … 31 common frames omitted

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
nils-christiancommented, Sep 20, 2022

Hi @smcvb,

Sounds good to me. I assumed that much.

Meanwhile we will continue with moving our code to 4.6.X and report further issues in case they arise. Unfortunately we have done a lot of customization making the migration from 4.5.15 to 4.6.0 more cumbersome than we originally hoped.

0reactions
smcvbcommented, Sep 19, 2022

Closing this issue since pull request [#2369] resolves it. Thanks a bunch for filing this with us as soon as you did, @nils-christian. The effort is very much appreciated 😃

Note that we’ll hold off a patch release for Axon Framework a bit more. In part because more bugs might surface and in part because we’re quite busy with AxonIQ’s conference coming up. Added, I think the workaround for this is doable: simply not excluding XStream. Although I’d say it’s not ideal, it’s not pressing enough to warrant an immediate release somewhere this week.

If you or others reading this feel other wise, pleas tell us! I’m basing myself on user assumptions here, so I’d like to know if those are wrong.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Repository and Event Store - Axon Reference Guide
The JDBC event storage engine uses a JDBC Connection to store Events in a JDBC compatible data storage. Typically, these are relational databases....
Read more >
Checking Whether the Source Database Tables Use Storage ...
Check whether the source database tables use storage engines not supported by the destination database. If yes, the migration fails.
Read more >
XStream Out Concepts - Oracle Help Center
XStream Out provides a transaction-based interface for streaming these changes to client applications. The client application can interact with other systems, ...
Read more >
A.2 MySQL 5.7 FAQ: Storage Engines
Yes. The disabled_storage_engines configuration option defines which storage engines cannot be used to create tables or tablespaces. By default, ...
Read more >
Releases · AxonFramework/AxonFramework - GitHub
Repository bean not available in Spring context #2367; Event storage engines cannot be used without XStream #2364; Concurrency conflicts in CachingSagaStore ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found