'NoClassDefFoundError on org.springframework.jms.listener.DefaultMessageListenerContainer on start Application

I have big Gradle project. When i ruunng application gradlew - bootRun or run Debug on InteljIdea I got exceptions

java.lang.NoClassDefFoundError: org/springframework/jms/listener/DefaultMessageListenerContainer

The creation of the war file occurs without errors, but when you run it on tomcat, a similar exception is thrown in the log file

full stacktrace from gradlew - bootRun

    2022-05-13 07:34:22,237 [main] ERROR       org.springframework.boot.SpringApplication  - Application startup failed
java.lang.NoClassDefFoundError: org/springframework/jms/listener/DefaultMessageListenerContainer
        at grails.plugin.jms.bean.DefaultJmsBeans$_run_closure3$_closure7.doCall(DefaultJmsBeans.groovy:36)
        at grails.plugin.jms.bean.DefaultJmsBeans$_run_closure3$_closure7.doCall(DefaultJmsBeans.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:56)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
        at groovy.util.ConfigSlurper$_parse_closure5.doCall(ConfigSlurper.groovy:258)
        at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:84)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1123)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:822)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:144)
        at groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java:46)
        at groovy.lang.Script.invokeMethod(Script.java:80)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:398)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:338)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:68)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
        at grails.plugin.jms.bean.DefaultJmsBeans$_run_closure3.doCall(DefaultJmsBeans.groovy:30)
        at grails.plugin.jms.bean.DefaultJmsBeans$_run_closure3.doCall(DefaultJmsBeans.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:56)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
        at groovy.util.ConfigSlurper$_parse_closure5.doCall(ConfigSlurper.groovy:258)
        at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:84)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1123)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:151)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:68)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
        at grails.plugin.jms.bean.DefaultJmsBeans.run(DefaultJmsBeans.groovy:29)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at org.codehaus.groovy.reflection.CachedMethod$invoke.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.reflection.CachedMethod$invoke.call(Unknown Source)
        at groovy.util.ConfigSlurper$_parse_closure5.doCall(ConfigSlurper.groovy:270)
        at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:84)
        at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1123)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:151)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:56)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
        at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:288)
        at groovy.util.ConfigSlurper$parse.callCurrent(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
        at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:162)
        at groovy.util.ConfigSlurper$parse$1.callCurrent(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:169)
        at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:151)
        at groovy.util.ConfigSlurper$parse$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
        at grails.plugin.jms.JmsGrailsPlugin.getDefaultConfig(JmsGrailsPlugin.groovy:89)
        at grails.plugin.jms.JmsGrailsPlugin.getJmsConfigurationWithDefaults(JmsGrailsPlugin.groovy:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:352)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:68)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:161)
        at grails.plugin.jms.JmsGrailsPlugin$_doWithSpring_closure1.doCall(JmsGrailsPlugin.groovy:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1427)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
        at groovy.lang.Closure.call(Closure.java:420)
        at groovy.lang.Closure.call(Closure.java:414)
        at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:759)
        at grails.spring.BeanBuilder.beans(BeanBuilder.java:588)
        at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:531)
        at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:559)
        at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:167)
        at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:171)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:122)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
        at grails.boot.GrailsApp.run(GrailsApp.groovy:84)
        at grails.boot.GrailsApp$run.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
        at com.galantis.ecm.solution.Application.main(Application.groovy:17)
Caused by: java.lang.ClassNotFoundException: org.springframework.jms.listener.DefaultMessageListenerContainer
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 150 common frames omitted
2022-05-13 07:34:22,259 [main] INFO        org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext  - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7876d598: startup date [Fri May 13 07:34:10 MSK 2022]; root of context hierarchy

I added in my Gradle.build

buildscript {
  repositories {
    mavenLocal()
    mavenCentral()
    maven { url "https://plugins.gradle.org/m2/" }
  }
  dependencies {
    classpath "org.grails:grails-gradle-plugin:$grailsVersion"
    classpath 'com.bertramlabs.plugins:asset-pipeline-grails:2.14.2'
    classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.14.2'
    classpath 'com.bertramlabs.plugins:asset-pipeline-core:2.14.2' 
    classpath 'org.springframework:spring-jms:4.3.22.RELEASE'
    classpath 'org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1'
  }
}

version = rootProject.version
group = 'com.galantis.ecm'
sourceCompatibility = 1.8

apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.grails.grails-plugin'
apply plugin: 'asset-pipeline'
apply plugin: 'org.grails.grails-gsp'
apply plugin: 'project-report'

// spring boot
  compileOnly 'org.springframework.boot:spring-boot-devtools'
  compile 'org.springframework.boot:spring-boot-starter-logging'
  compile 'org.springframework.boot:spring-boot-starter-websocket'
  compile 'com.hazelcast:hazelcast-spring'

  // grails
  compile 'org.grails:grails-core'
  compile 'org.grails:grails-web-boot'
  compile 'org.grails:grails-logging'
  compile "org.grails:grails-dependencies:$grailsVersion"
  compile "org.grails:grails-events-compat:3.3.2" //KAE
  compile "org.grails:grails-async:3.3.2" //KAE
  compile 'org.grails:grails-plugin-rest'
  compile 'org.grails:grails-plugin-i18n'
  compile 'org.grails:grails-plugin-services'
  compile 'org.grails:grails-plugin-url-mappings'
  compile 'org.grails:grails-plugin-interceptors'
  compile "org.grails.plugins:cache"
  compile 'org.grails.plugins:scaffolding'
  compile 'org.grails.plugins:gsp' 
  compile "org.grails.plugins:async" 
  compile 'org.grails.plugins:jms:2.0.0.RC2'
  compile "org.grails:grails-taglib:3.3.2" 
  compile "org.grails:grails-web-taglib:3.3.2" 
  compile "org.grails:grails-web-gsp-taglib:3.3.2" 
  compile "org.grails:grails-web-jsp:3.3.2" 
  compile 'opensymphony:sitemesh:2.4.2' 
  console 'org.grails:grails-console'
  profile 'org.grails.profiles:web-plugin'
  runtime 'com.bertramlabs.plugins:asset-pipeline-grails:2.14.2'
  runtime 'com.bertramlabs.plugins:asset-pipeline-core:2.14.2' //Add this for some bug fixes
  runtime 'com.bertramlabs.plugins:asset-pipeline-gradle:2.14.2'

  // javascript library
  assets 'org.webjars.npm:sockjs-client:1.3.0'
  assets 'org.webjars.npm:webstomp-client:1.2.6'

  // xlsx report
  compile 'org.apache.poi:poi-ooxml:3.16'

  // pdf split
  compile 'com.itextpdf:itextpdf:5.5.13'

  // custom
  compile 'org.springframework:spring-jms'
  compile 'org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1'
  compile 'org.kefirsf:kefirbb:1.5'
  compile 'org.apache.activemq:activemq-client:5.15.2'
  compile 'org.grails:grails-datastore-rest-client:6.1.9.RELEASE'
  compile 'com.github.sarxos:webcam-capture:0.3.10'
  compile 'com.github.sarxos:webcam-capture-driver-ipcam:0.3.10'
  
  compile('com.github.java-json-tools:json-schema-validator:2.2.8') {
    exclude group: 'javax.mail', module: 'mailapi'
  }

  compile 'org.apache.pdfbox:pdfbox:2.0.8'
  compile 'org.apache.tika:tika-core:1.18'
  testCompile 'org.grails:grails-plugin-testing'
  testCompile 'org.grails:grails-web-testing-support'
  testCompile 'org.projectlombok:lombok:1.18.8'
}

The error remained. How to find the error?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source