bertramdev / asset-pipeline

The core implementation of the asset pipeline for the jvm
193 stars 91 forks source link

asset-pipeline 3.0.10 and grails 3.3.8 gives FilterRegistrationBean not found error #247

Closed manishb-socialcurry closed 4 years ago

manishb-socialcurry commented 4 years ago

After migrating my application from Grails 2.4.3 to Grails 3.3.8 and using the new spring security plugin, while compilation of Java/Groovy files and war assembly goes okay, I get the FilterRegistrationBean not found error during deployment.

As you can see from my build.gradle, I am using the following versions of spring security plugins: compile "org.grails.plugins:spring-security-core:3.2.1" compile "org.grails.plugins:spring-security-ui:3.1.1" I have tried all other combinations possible. Like, 3.2.3 of spring-security-core and 3.1.2 of spring-security-ui. I know that Spring boot 1.5 that is used by Grails 3.3 has moved the FilterRegistrationBean to a different package. Still, I cannot figure out why I am getting the exception.

I also tried to switch to the latest version of com.bertramlabs.plugins:asset-pipeline-gradle, but the error did not go away. Please help.

build.gradle:

buildscript {
    ext {
        grailsVersion = project.grailsVersion
    }
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
        mavenCentral()
        maven { url "https://repo.grails.org/grails/core" }
        mavenLocal()
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:3.0.10'
        classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
        classpath "gradle.plugin.agorapulse.plugins:asset-pipeline-cdn:0.1.3"
    }
}

plugins {
    id "io.spring.dependency-management" version "0.5.4.RELEASE"
    id "com.bertramlabs.asset-pipeline" version "3.0.10"
    id "agorapulse.plugins.asset-pipeline-cdn" version "0.1.3"
}

version "0.1"
group "ite.baseline"

apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "org.springframework.boot"
apply plugin: "war"
apply plugin: "com.bertramlabs.asset-pipeline"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
apply plugin: "agorapulse.plugins.asset-pipeline-cdn"

ext {
    grailsVersion = project.grailsVersion
    gradleWrapperVersion = project.gradleWrapperVersion
}

assets {
    minifyJs = true
    minifyCss = true
}

assetsCdn {
    provider = 's3' // Karman provider
    accessKey = 'AKIAI32F6EOPEVYQNAMQ'
    secretKey = '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'
    directory = 'itexchangeweb-static-assets-new'
    storagePath = "assets/itexchangeweb-0.1/"
    expires = 3650 // Expires in 10 years (value in days)
    gzip = true
    //region = 'us-east-1'
}

repositories {
    mavenCentral()
    maven { url "https://plugins.gradle.org/m2/" }
    maven { url "https://repo.grails.org/grails/core" }
    mavenLocal()
}

dependencyManagement {
    imports {
        mavenBom "org.grails:grails-bom:3.3.8"
    }
    applyMavenExclusions false
}

dependencies {
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.springframework.boot:spring-boot-starter-tomcat"

    compile "org.grails:grails-logging"
    compile "org.grails:grails-plugin-rest"
    compile "org.grails:grails-plugin-databinding"
    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:grails-dependencies"
    compile "org.grails:grails-web-boot"
    runtime "org.springframework:spring-test"
    compile "org.apache.httpcomponents:httpcore"
    compile "org.apache.httpcomponents:httpclient"

    compile "org.grails.plugins:gsp"

//      compile 'org.grails.plugins:audit-logging:2.0.6'

    compile "org.grails.plugins:scaffolding"
    compile "org.grails.plugins:cache"

    compile "commons-io:commons-io:2.4"
    compile "org.xhtmlrenderer:flying-saucer-pdf-itext5:9.1.18"
    compile "org.grails.plugins:joda-time:2.1.0"
    compile "org.grails.plugins:quartz-monitor:1.3"
    compile "org.grails.plugins:remote-pagination:0.5.0"
    compile "org.grails.plugins:ckeditor:4.5.9.0"
    compile "org.grails.plugins:grails-pretty-time:4.0.0"
    compile 'com.bertramlabs.plugins:karman-grails:1.2.1'
    compile "org.grails.plugins:asynchronous-mail:2.0.2"

    compile "org.grails.plugins:spring-security-core:3.2.3"
    compile "org.grails.plugins:spring-security-ui:3.1.2"

    compile "mysql:mysql-connector-java:5.1.24"

    compile "org.grails.plugins:hibernate5"
    compile "org.hibernate:hibernate-core:5.1.5.Final"
    compile "org.hibernate:hibernate-ehcache:5.1.5.Final"
    compile ("org.grails.plugins:cache-ehcache:3.0.0.M1") {
        exclude group:'net.sf.ehcache'
    }
    compile "net.sf.ehcache:ehcache:2.4.3"

    compile "org.grails.plugins:aws-sdk:1.10.74"
    compile 'org.grails.plugins:converters:4.0.0'
    compile "org.grails.plugins:html-cleaner:3.0.0.1"

    // The following has been separated out in grails 3.3
    compile "org.grails:grails-datastore-gorm-async:6.1.9.RELEASE"

    // plugins needed at runtime
    runtime('org.grails.plugins:rendering:2.0.3', {
        //exclude group: '', module: ''
        //excludes 'itext','itext-rtf'
    })

    runtime group: 'com.bertramlabs.plugins', name: 'asset-pipeline-core', version: '3.0.10'
    runtime "org.grails.plugins:events:4.0.0"
    runtime 'org.grails.plugins:aws-sdk:1.10.74'
    runtime "org.grails.plugins:database-migration:3.0.4"

    // plugin needed to use TLD files for JSP taglibs
    runtime "org.grails:grails-web-jsp"
    runtime "org.grails.plugins:hibernate5"
    runtime "org.hibernate:hibernate-core:5.1.5.Final"
    runtime "org.hibernate:hibernate-ehcache:5.1.5.Final"
    runtime "mysql:mysql-connector-java:5.1.24"

    testCompile "org.grails.plugins:geb:1.1.4"
    testCompile "org.grails:grails-test-mixins:3.3.0"
    testCompile "org.grails.plugins:hibernate5"
    testCompile "org.hibernate:hibernate-core:5.1.5.Final"
    testCompile "org.hibernate:hibernate-ehcache:5.1.5.Final"
    testCompile "mysql:mysql-connector-java:5.1.24"

    console "org.grails:grails-console"
}
grails {
    pathingJar = true
}

bootRun {
    jvmArgs('-Dspring.output.ansi.enabled=always')
    addResources = true
}

wrapper {
    gradleVersion = gradleWrapperVersion
}

Stacktrace:

2019-09-13 12:35:52,687 [main] DEBUG g.c.DefaultGrailsApplication - Going to inspect artefact classes.
2019-09-13 12:36:05,822 [main] ERROR o.s.b.SpringApplication - Application startup failed
java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean
    at asset.pipeline.AssetPipelineGrailsPlugin$_doWithSpring_closure1.doCall(AssetPipelineGrailsPlugin.groovy:104)
    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:418)
    at groovy.lang.Closure.call(Closure.java:412)
    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:122)
    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(GrailsApp.groovy:393)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:380)
    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:136)
    at ite.baseline.Application.main(Application.groovy:8)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 34 common frames omitted
davydotcom commented 4 years ago

Your using the wrong org on the asset-pipeline-grails package. It’s the old one that was temporarily a non bertramdev org during the transition to grails 3.0

Sent from my iPhone

On Sep 13, 2019, at 3:15 AM, manishb-socialcurry notifications@github.com wrote:

 After migrating my application from Grails 2.4.3 to Grails 3.3.8 and using the new spring security plugin, while compilation of Java/Groovy files and war assembly goes okay, I get the FilterRegistrationBean not found error during deployment.

As you can see from my build.gradle, I am using the following versions of spring security plugins: compile "org.grails.plugins:spring-security-core:3.2.1" compile "org.grails.plugins:spring-security-ui:3.1.1" I have tried all other combinations possible. Like, 3.2.3 of spring-security-core and 3.1.2 of spring-security-ui. I know that Spring boot 1.5 that is used by Grails 3.3 has moved the FilterRegistrationBean to a different package. Still, I cannot figure out why I am getting the exception.

I also tried to switch to the latest version of com.bertramlabs.plugins:asset-pipeline-gradle, but the error did not go away. Please help.

build.gradle:

buildscript { ext { grailsVersion = project.grailsVersion } repositories { maven { url "https://plugins.gradle.org/m2/" } mavenCentral() maven { url "https://repo.grails.org/grails/core" } mavenLocal() } dependencies { classpath "org.grails:grails-gradle-plugin:$grailsVersion" classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:3.0.10' classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}" classpath "gradle.plugin.agorapulse.plugins:asset-pipeline-cdn:0.1.3" } }

plugins { id "io.spring.dependency-management" version "0.5.4.RELEASE" id "com.bertramlabs.asset-pipeline" version "3.0.10" id "agorapulse.plugins.asset-pipeline-cdn" version "0.1.3" }

version "0.1" group "ite.baseline"

apply plugin: "eclipse" apply plugin: "idea" apply plugin: "org.springframework.boot" apply plugin: "war" apply plugin: "com.bertramlabs.asset-pipeline" apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: "org.grails.grails-web" apply plugin: "org.grails.grails-gsp" apply plugin: "agorapulse.plugins.asset-pipeline-cdn"

ext { grailsVersion = project.grailsVersion gradleWrapperVersion = project.gradleWrapperVersion }

assets { minifyJs = true minifyCss = true }

assetsCdn { provider = 's3' // Karman provider accessKey = 'AKIAI32F6EOPEVYQNAMQ' secretKey = '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' directory = 'itexchangeweb-static-assets-new' storagePath = "assets/itexchangeweb-0.1/" expires = 3650 // Expires in 10 years (value in days) gzip = true //region = 'us-east-1' }

repositories { mavenCentral() maven { url "https://plugins.gradle.org/m2/" } maven { url "https://repo.grails.org/grails/core" } mavenLocal() }

dependencyManagement { imports { mavenBom "org.grails:grails-bom:3.3.8" } applyMavenExclusions false }

dependencies { compile "org.grails:grails-core" compile "org.springframework.boot:spring-boot-starter-logging" compile "org.springframework.boot:spring-boot-starter-actuator" compile "org.springframework.boot:spring-boot-autoconfigure" compile "org.springframework.boot:spring-boot-starter-tomcat"

compile "org.grails:grails-logging" compile "org.grails:grails-plugin-rest" compile "org.grails:grails-plugin-databinding" 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:grails-dependencies" compile "org.grails:grails-web-boot" runtime "org.springframework:spring-test" compile "org.apache.httpcomponents:httpcore" compile "org.apache.httpcomponents:httpclient"

compile "org.grails.plugins:gsp"

// compile 'org.grails.plugins:audit-logging:2.0.6'

compile "org.grails.plugins:scaffolding" compile "org.grails.plugins:cache"

compile "commons-io:commons-io:2.4" compile "org.xhtmlrenderer:flying-saucer-pdf-itext5:9.1.18" compile "org.grails.plugins:joda-time:2.1.0" compile "org.grails.plugins:quartz-monitor:1.3" compile "org.grails.plugins:remote-pagination:0.5.0" compile "org.grails.plugins:ckeditor:4.5.9.0" compile "org.grails.plugins:grails-pretty-time:4.0.0" compile 'com.bertramlabs.plugins:karman-grails:1.2.1' compile "org.grails.plugins:asynchronous-mail:2.0.2"

compile "org.grails.plugins:spring-security-core:3.2.3" compile "org.grails.plugins:spring-security-ui:3.1.2"

compile "mysql:mysql-connector-java:5.1.24"

compile "org.grails.plugins:hibernate5" compile "org.hibernate:hibernate-core:5.1.5.Final" compile "org.hibernate:hibernate-ehcache:5.1.5.Final" compile ("org.grails.plugins:cache-ehcache:3.0.0.M1") { exclude group:'net.sf.ehcache' } compile "net.sf.ehcache:ehcache:2.4.3"

compile "org.grails.plugins:aws-sdk:1.10.74" compile 'org.grails.plugins:converters:4.0.0' compile "org.grails.plugins:html-cleaner:3.0.0.1"

// The following has been separated out in grails 3.3 compile "org.grails:grails-datastore-gorm-async:6.1.9.RELEASE"

// plugins needed at runtime runtime('org.grails.plugins:rendering:2.0.3', { //exclude group: '', module: '' //excludes 'itext','itext-rtf' })

runtime group: 'com.bertramlabs.plugins', name: 'asset-pipeline-core', version: '3.0.10' runtime "org.grails.plugins:events:4.0.0" runtime 'org.grails.plugins:aws-sdk:1.10.74' runtime "org.grails.plugins:database-migration:3.0.4"

// plugin needed to use TLD files for JSP taglibs runtime "org.grails:grails-web-jsp" runtime "org.grails.plugins:hibernate5" runtime "org.hibernate:hibernate-core:5.1.5.Final" runtime "org.hibernate:hibernate-ehcache:5.1.5.Final" runtime "mysql:mysql-connector-java:5.1.24"

testCompile "org.grails.plugins:geb:1.1.4" testCompile "org.grails:grails-test-mixins:3.3.0" testCompile "org.grails.plugins:hibernate5" testCompile "org.hibernate:hibernate-core:5.1.5.Final" testCompile "org.hibernate:hibernate-ehcache:5.1.5.Final" testCompile "mysql:mysql-connector-java:5.1.24"

console "org.grails:grails-console" } grails { pathingJar = true }

bootRun { jvmArgs('-Dspring.output.ansi.enabled=always') addResources = true }

wrapper { gradleVersion = gradleWrapperVersion }

Stacktrace:

2019-09-13 12:35:52,687 [main] DEBUG g.c.DefaultGrailsApplication - Going to inspect artefact classes. 2019-09-13 12:36:05,822 [main] ERROR o.s.b.SpringApplication - Application startup failed java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean at asset.pipeline.AssetPipelineGrailsPlugin$_doWithSpring_closure1.doCall(AssetPipelineGrailsPlugin.groovy:104) 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:418) at groovy.lang.Closure.call(Closure.java:412) 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:122) 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(GrailsApp.groovy:393) at grails.boot.GrailsApp.run(GrailsApp.groovy:380) 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:136) at ite.baseline.Application.main(Application.groovy:8) Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 34 common frames omitted

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jndietz commented 4 years ago

@davydotcom What do you mean "org"? Do you mean "group"? Also, @manishb-socialcurry doesn't appear to have asset-pipeline-grails declared anywhere, though he is using asset-pipeline-core.

davydotcom commented 4 years ago

its probably being included wrong from one of your transitive dependencies that you have to lock down and find using gradle dependencies.

The Gist is in the past there was a released org.grails.plugins group of asset-pipeline grails with a version matching the grails version. This was moved out to com.bertramlabs.plugins to be consistent with asset-pipeline-core. Check dependencies and see what is including that old version.