cancel
Showing results for 
Search instead for 
Did you mean: 

jdk21 upgrade:java.lang.NoClassDefFoundError: org/apache/commons/configuration/AbstractConfiguration

12-19-2025 10:05 AM
2123 views 3 comments
0 Likes
SAP Managed Tags
Labels
JDK21 upgrade
Subscribe

I am in the process of upgrading our SAP Commerce platform to JDK 21 with Spring 6.

After fixing all compilation errors,

we have used <dependency><br><groupId>org.apache.commons</groupId><br><artifactId>commons-configuration2</artifactId><br><version>2.12.0</version><br></dependency></p><p> </p><p> </p><p>but getting below error:</p><p> </p><p>

 

Exception sending context initialized event to listener instance of class [de.hybris.platform.spring.HybrisContextLoaderListener]<br>java.lang.NoClassDefFoundError: org/apache/commons/configuration/AbstractConfiguration<br>        at java.base/java.lang.Class.forName0(Native Method)<br>        at java.base/java.lang.Class.forName(Class.java:423)<br>        at java.base/java.lang.Class.forName(Class.java:414)<br>        at io.ecx.mondi.core.annotation.processors.BeanAliasPostProcessor.processDefinition(BeanAliasPostProcessor.java:49)<br>        at io.ecx.mondi.core.annotation.processors.BeanAliasPostProcessor.postProcessBeanDefinitionRegistry(BeanAliasPostProcessor.java:36)<br>        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)<br>        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:148)<br>        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:791)<br>        at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:609)<br>        at org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh(AbstractApplic

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

geronasso
Product and Topic Expert
Product and Topic Expert

Please check if somehow this may help you:

 

Troubleshooting: SAP Commerce JDK 21 & Spring 6 Upgrade - Commons Configuration Dependency Issue

 

Root Cause

The error indicates that your application code or dependencies are still referencing classes from the legacy commons-configuration (version 1.x) package structure, specifically org.apache.commons.configuration.AbstractConfiguration. However, you've upgraded to commons-configuration2 (version 2.x), which uses a different package structure: org.apache.commons.configuration2.* [1].

Dependency Conflict
  • Commons Configuration 1.x uses package org.apache.commons.configuration.*
  • Commons Configuration 2.x uses package org.apache.commons.configuration2.*
  • Your custom code (BeanAliasPostProcessor) is still referencing the old package structure
  • Spring 6 and JDK 21 require updated dependency versions that may have transitive dependencies expecting the newer package structure

Resolution Steps

  1. Verify Current Dependencies

    Copy code
    1# Check dependency tree for conflicting versions
    2./gradlew dependencies | grep -i configuration
    3# or for Maven
    4mvn dependency:tree | grep -i configuration

    Look for any remaining commons-configuration:commons-configuration:1.x dependencies.

  2. Update Dependency Configuration Replace your current dependency with the correct configuration:

    Copy code
    1
    2    org.apache.commons
    3    commons-configuration2
    4    2.12.0
    5
    6
    7
    8    
    9        commons-configuration
    10        commons-configuration
    11    
    12
  3. Update Custom Code Modify your BeanAliasPostProcessor.java and any other custom code:

    Copy code
    1// Change from:
    2import org.apache.commons.configuration.AbstractConfiguration;
    3
    4// To:
    5import org.apache.commons.configuration2.AbstractConfiguration;
  4. Clean and Rebuild

    Copy code
    1# For SAP Commerce
    2ant clean all
    3
    4# Clear any cached dependencies
    5rm -rf ~/.m2/repository/org/apache/commons/commons-configuration*
    6rm -rf ~/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-configuration*

Alternative Solutions

Option 1: Dependency Exclusion

Add explicit exclusions to prevent transitive dependencies from pulling in the old version:

Copy code
1
2    your-dependency-group
3    your-dependency-artifact
4    your-version
5    
6        
7            commons-configuration
8            commons-configuration
9        
10    
11
Option 2: Use OpenRewrite Migration

Leverage SAP's OpenRewrite recipes for automated code migration [2]:

Copy code
1# Download sap-commerce-framework-update-recipes-1.1.3.jar
2./gradlew rewriteRun \
3  --init-script=init.gradle \
4  -PcommerceUpdatePaths="../custom/your-extension" \
5  -Drewrite.activeRecipe=com.sap.cx.rewrite.java.SelectiveCommerceCloudFrameworkUpdate

Validation Checklist

  • Dependency tree shows only commons-configuration2 (no version 1.x)
  • All custom code imports updated to org.apache.commons.configuration2.*
  • No conflicting transitive dependencies in build output
  • Application starts without NoClassDefFoundError
  • SAP Commerce HybrisContextLoaderListener initializes successfully

Prevention Measures

  • Use SAP's official OpenRewrite recipes for automated dependency migration [2]
  • Implement dependency management in your build files to control transitive versions
  • Test upgrades in isolated environments before production deployment
  • Follow SAP's Framework Update documentation for JDK 21 migration [3],

Related Issues

  • Similar XML parsing issues may occur with other Apache Commons libraries [4]
  • Spring 6 requires Jakarta namespace transitions (javax.* → jakarta.*) ,
  • Consider updating other Apache Commons libraries (commons-io, commons-compress) to compatible versions [5]

Would you like me to help you identify which specific dependencies in your project might be pulling in the legacy commons-configuration version?

0 Likes
Hi Geronasso, Thank you very much for your effort and continued support. I have tried cleaning up all generated .jar and .class files and also searched my workspace for any references to commons-configuration:commons-configuration:1.x. I ran the following commands: Get-ChildItem -Recurse -Filter *.jar | ForEach-Object { jar tf $_.FullName | Select-String "commons/configuration" } Get-ChildItem bin -Recurse -Filter *.jar | ForEach-Object { jar tf $_.FullName | Select-String "commons/configuration" } In addition, I also ran: mvn dependency:tree | grep -i configuration However, none of these commands returned any results related to Commons Configuration 1.x. Please let me know if there are any other areas you would recommend checking, or if you need any additional details from my side. Thanks again for your support.
0 Likes

i am getitng error like : SEVERE: Exception sending context initialized event to listener instance of class [io.ecx.mondi.loginportal.filters.HybrisStorefrontContextLoaderListener] INFO | jvm 1 | main | 2025/12/29 14:45:59.372 | java.lang.NoClassDefFoundError: org/apache/commons/configuration/AbstractConfiguration INFO | jvm 1 | main | 2025/12/29 14:45:59.372 | at java.base/java.lang.Class.forName0(Native Method) INFO | jvm 1 | main | 2025/12/29 14:45:59.372 | at java.base/java.lang.Class.forName(Class.java:423) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at java.base/java.lang.Class.forName(Class.java:414) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at de.hybris.platform.spring.LazyInitOverrideBeanFactoryPostProcessor.forName(LazyInitOverrideBeanFactoryPostProcessor.java:82) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at java.base/java.util.Optional.map(Optional.java:260) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at de.hybris.platform.spring.LazyInitOverrideBeanFactoryPostProcessor.postProcessBeanFactory(LazyInitOverrideBeanFactoryPostProcessor.java:51) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:363) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:204) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:791) INFO | jvm 1 | main | 2025/12/29 14:45:59.373 | at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:609) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh(AbstractApplicationContext.java:41002) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:42008) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.HybrisContextFactory.refreshContext(HybrisContextFactory.java:88) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.HybrisContextFactory$ApplicationContextFactory.build(HybrisContextFactory.java:256) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.HybrisContextHolder.getApplicationInstance(HybrisContextHolder.java:78) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.AbstractTenant.createCoreApplicationContext(AbstractTenant.java:815) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.AbstractTenant.doStartupSafe(AbstractTenant.java:856) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.AbstractTenant.doStartUp(AbstractTenant.java:781) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.Registry.assureTenantStarted(Registry.java:658) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.Registry.activateTenant(Registry.java:719) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.Registry.setCurrentTenant(Registry.java:568) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.Registry.activateMasterTenant(Registry.java:627) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.Registry.startup(Registry.java:441) INFO | jvm 1 | main | 2025/12/29 14:45:59.374 | at de.hybris.platform.core.ClassLoaderUtils.executeWithWebClassLoaderParentIfNeeded(ClassLoaderUtils.java:35) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at de.hybris.platform.spring.HybrisContextLoaderListener.startRegistry(HybrisContextLoaderListener.java:353) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at de.hybris.platform.spring.HybrisContextLoaderListener.doInitWebApplicationContext(HybrisContextLoaderListener.java:213) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at de.hybris.platform.spring.HybrisContextLoaderListener.initWebApplicationContext(HybrisContextLoaderListener.java:200) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:126) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at de.hybris.platform.spring.HybrisContextLoaderListener.contextInitializedInternal(HybrisContextLoaderListener.java:97) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at de.hybris.platform.spring.HybrisContextLoaderListener.contextInitialized(HybrisContextLoaderListener.java:92) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4046) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4474) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) INFO | jvm 1 | main | 2025/12/29 14:45:59.375 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63) INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | at java.base/java.lang.Thread.run(Thread.java:1583) INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | Caused by: java.lang.ClassNotFoundException: Could not find class: org.apache.commons.configuration.AbstractConfiguration INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | at de.hybris.bootstrap.loader.PlatformInPlaceClassLoader.loadClass(PlatformInPlaceClassLoader.java:148) INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | ... 41 more INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | Dec 29, 2025 2:45:59 PM org.apache.catalina.core.StandardContext startInternal INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | Dec 29, 2025 2:45:59 PM org.apache.catalina.core.StandardContext startInternal INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | SEVERE: Context [] startup failed due to previous errors INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | Dec 29, 2025 2:45:59 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesRmiTargets INFO | jvm 1 | main | 2025/12/29 14:45:59.376 | WARNING: You need to add "--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED" to the JVM command line arguments to enable RMI Target memory leak detection. Alternatively, you can suppress this warning by disabling RMI Target memory leak detection. INFO | jvm 1 | main | 2025/12/29 14:45:59.418 | Dec 29, 2025 2:45:59 PM org.apache.coyote.AbstractProtocol start INFO | jvm 1 | main | 2025/12/29 14:45:59.418 | INFO: Starting ProtocolHandler ["http-nio-9001"] INFO | jvm 1 | main | 2025/12/29 14:45:59.433 | Dec 29, 2025 2:45:59 PM org.apache.coyote.AbstractProtocol start INFO | jvm 1 | main | 2025/12/29 14:45:59.433 | INFO: Starting ProtocolHandler ["ajp-nio-127.0.0.1-8009"] INFO | jvm 1 | main | 2025/12/29 14:45:59.449 | Dec 29, 2025 2:45:59 PM org.apache.catalina.startup.Catalina start INFO | jvm 1 | main | 2025/12/29 14:45:59.449 | INFO: Server startup in [900945] milliseconds INFO | jvm 1 | main | 2025/12/29 22:27:43.723 | Dec 29, 2025 10:27:43 PM com.microsoft.sqlserver.jdbc.SQLServerConnection prelogin INFO | jvm 1 | main | 2025/12/29 22:27:43.729 | WARNING: ConnectionID:716 ClientConnectionId: d6b2cd20-300c-43ba-818a-c911e160c249 Prelogin error: host 193.228.88.17 port 1433 Unexpected end of prelogin response after 0 bytes read INFO | jvm 1 | main | 2025/12/29 22:27:53.764 | Dec 29, 2025 10:27:53 PM com.microsoft.sqlserver.jdbc.SQLServerConnection prelogin INFO | jvm 1 | main | 2025/12/29 22:27:53.764 | WARNING: ConnectionID:717 ClientConnectionId: 8992ebc2-22fb-4580-bf82-8bbf38e3b58a Prelogin error: host 193.228.88.17 port 1433 Unexpected end of prelogin response after 0 bytes read INFO | jvm 1 | main | 2025/12/29 22:28:03.835 | Dec 29, 2025 10:28:03 PM com.microsoft.sqlserver.jdbc.SQLServerConnection prelogin INFO | jvm 1 | main | 2025/12/29 22:28:03.835 | WARNING: ConnectionID:718 ClientConnectionId: 70e7538f-933a-46ae-b7b9-50b3a401f088 Prelogin error: host 193.228.88.17 port 1433 Unexpected end of prelogin response after 0 bytes read INFO | jvm 1 | main | 2025/12/29 22:28:13.889 | Dec 29, 2025 10:28:13

atmprakash_b_sharma16_0-1767102269183.png