0

Currently we're having an issue related to SpringBoot. When we compile and run the application we're getting the following error. Somehow this error seems to be related to the axon framework:

"error":"\n\njava.lang.NoClassDefFoundError: 
org.springframework.boot.configurationprocessor.json.JSONException\n\tat 
java.base/java.lang.Class.getDeclaredMethods(Unknown Source)\n\tat 
org.axonframework.common.ReflectionUtils.addMethodsOnDeclaredInterfaces(ReflectionUtils.java:311)\n\tat 
org.axonframework.common.ReflectionUtils.methodsOf(ReflectionUtils.java:245)\n\tat 
org.axonframework.spring.config.SpringAxonAutoConfigurer.lambda$registerEventHandlerRegistrar$14(SpringAxonAutoConfigurer.java:265)\n\tat 
org.axonframework.spring.config.SpringAxonAutoConfigurer$$Lambda$559/0x00000000a8edee00.accept(Unknown Source)\n\tat 
java.base/java.util.Iterator.forEachRemaining(Unknown Source)\n\tat 
org.axonframework.spring.config.SpringAxonAutoConfigurer.registerEventHandlerRegistrar(SpringAxonAutoConfigurer.java:259)\n\tat 
org.axonframework.spring.config.SpringAxonAutoConfigurer.registerBeanDefinitions(SpringAxonAutoConfigurer.java:225)\n\tat
org.springframework.context.annotation.ImportBeanDefinitionRegistrar.registerBeanDefinitions(ImportBeanDefinitionRegistrar.java:86)\n\tat 
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:396)\n\tat 
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$$Lambda$353/0x00000000a8bf3980.accept(Unknown Source)\n\tat 
java.base/java.util.LinkedHashMap.forEach(Unknown Source)\n\tat 
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:395)\n\tat 
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:157)\n\tat 
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129)\n\tat 
org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343)\n\tat 
org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)\n\tat 
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)\n\tat 
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112)\n\tat 
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)\n\tat 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)\n\tat 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)\n\tat 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)\n\tat 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)\n\tat 
org.springframework.boot.SpringApplication.run(SpringApplication.java:308)\n\tat 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)\n\tat 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)\n\tat 
sa.jawwy.microservices.inboxcommunication.application.InboxCommunicationApplication.main(InboxCommunicationApplication.java:17)\n\tat 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\n\tat 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\n\tat 
java.base/java.lang.reflect.Method.invoke(Unknown Source)\n\tat 
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)\n\tat
 org.springframework.boot.loader.Launcher.launch(Launcher.java:108)\n\tat 
 org.springframework.boot.loader.Launcher.launch(Launcher.java:58)\n\tat 
 org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)\n
 
 Caused by: java.lang.ClassNotFoundException: org.springframework.boot.configurationprocessor.json.JSONException\n\tat 
 java.base/java.net.URLClassLoader.findClass(Unknown Source)\n\tat 
 java.base/java.lang.ClassLoader.loadClassHelper(Unknown Source)\n\tat 
 java.base/java.lang.ClassLoader.loadClass(Unknown Source)\n\tat 
 org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)\n\tat 
 java.base/java.lang.ClassLoader.loadClass(Unknown Source)\n\tat 
 java.base/java.lang.Class.getDeclaredMethodsImpl(Native Method)\n\t... 36 common frames omitted\n\n"}

The Spring boot version we are currently using is 2.7.0 whereas axon is on version 4.4.

Anyone got any ideas?

1
  • 2
    Caused by: java.lang.ClassNotFoundException: org.springframework.boot.configurationprocessor.json.JSONException , simple terms, this class JSONException cannot be found under your maven libraries or dependencies ! Can you check if axon 4.4 has that class ? Or check if you have more than one version of the same dependency where in one picked up doesn't have that class Commented Aug 29, 2022 at 13:10

1 Answer 1

1

The org.springframework.boot.configurationprocessor.json.JSONException is part of the configuration-processor dependency:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
</dependency>

However, this dependency is not present when running the application. Axon Framework scans the classpath for message handlers during boot and encounters a class where this exception is used. This automatically causes the JRE to load the class and fail, resulting in this exception. You should thus add this dependency to the runtime to resolve the issue.

In addition, the Spring boot configuration processor is actually not something that should be used in your own code. It's an internal exception of this processor, stating as its javadoc: Thrown to indicate a problem with the JSON API. So I would suggest not using it in the first place.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.