Tomcat 上的 Grails 3.3.0.RC 部署问题
Grails 3.3.0.RC Deployment Issue on Tomcat
当我尝试在从 3.2.9 升级到 3.3.0.RC1(在我的本地环境中工作正常)后部署我的应用程序时,出现以下错误消息。
我在 tomcat 8.0.20、8.0.28 和 8.5.16 中尝试过。有人知道可能出了什么问题吗?
欢迎随时询问更多信息。
2017-07-05 11:28:52.960 INFO --- [ost-startStop-2] fnx1.ApplicationLoader : Starting ApplicationLoade
r on krake08.fzi.de with PID 2015 (/usr/lib/apache-tomcat-8.5.16/webapps/ROOT/WEB-INF/classes started by root in /usr/li
b/apache-tomcat-8.5.16)
2017-07-05 11:28:52.966 DEBUG --- [ost-startStop-2] fnx1.ApplicationLoader : Running with Spring Boot
v1.5.4.RELEASE, Spring v4.3.9.RELEASE
2017-07-05 11:28:52.966 INFO --- [ost-startStop-2] fnx1.ApplicationLoader : The following profiles ar
e active: production
2017-07-05 11:28:57.013 ERROR --- [ost-startStop-2] o.s.boot.SpringApplication : Application startup faile
d
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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:408)
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(GrailsApplicationPostProc
essor.groovy:171)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostPro
cessorRegistrationDelegate.java:118)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplic
ationContext.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:83)
at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
at org.grails.boot.context.web.GrailsAppServletInitializer.createRootApplicationContext(GrailsAppServletInitiali
zer.groovy:57)
...
非常感谢!
编辑:我附加了我的 build.gradle 文件。也许这有助于解决问题。
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "http://dl.bintray.com/grails/plugins" }
maven { url "http://dl.bintray.com/zyro/maven" } //Websocket
maven { url "http://dl.bintray.com/jamescookie/plugins" } //Quartz Monitor
maven { url "http://download.java.net/maven/2/" }
maven { url "http://repo.spring.io/milestone/" }
maven { url "http://mvnrepository.com/artifact/" }
maven { url "https://mvnrepository.com/artifact/org.apache.commons/commons-lang3" } //StringEscapeUtils
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
// classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.5.0'
// classpath 'org.grails.plugins:asset-pipeline:3.2.1'
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.2"
classpath "org.grails.plugins:hibernate4:5.0.0" //hibernate:4.3.10.7
}
}
//plugins {
// id "io.spring.dependency-management" version "0.5.2.RELEASE"
//}
version "1.0.0"
group "fnx1"
apply plugin: "org.springframework.boot"
apply plugin: "war"
apply plugin: "asset-pipeline"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
set "tomcat.version", "8.5.5"
}
assets {
minifyJs = true
minifyCss = true
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
provided "org.springframework.boot:spring-boot-starter-tomcat"
// compile "org.grails:grails-dependencies"
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-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding" //runtime
compile "org.grails.plugins:hibernate5"
compile "org.grails.plugins:async"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:events"
compile "org.hibernate:hibernate-ehcache"
compile "org.hibernate:hibernate-core:5.1.5.Final"
compile "org.grails.plugins:gsp"
console "org.grails:grails-console"
console "org.grails:grails-console"
profile "org.grails.profiles:web:3.1.0" //new
compile "javax.xml.soap:saaj-api:1.3.4"
compile "com.sun.xml.messaging.saaj:saaj-impl:1.3"
// compile "org.grails.plugins:asset-pipeline:3.2.1" //:3.2.1
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.2"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1'
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
//Own dependencies - Start
// compile 'org.grails.plugins:spring-security-core:3.1.1'
compile 'org.grails.plugins:spring-security-core:3.2.0.M1'
// compile 'org.grails.plugins:spring-security-appinfo:3.0.0'
compile 'org.grails.plugins:quartz:2.0.12'
// compile 'org.grails.plugins:quartz-monitor:1.3'
// compile 'org.grails.plugins:mail:2.0.0.RC6'
compile 'org.grails.plugins:grails-spring-websocket:2.3.0'
// compile 'org.grails.plugins:database-migration:2.0.0.RC1'
// compile 'org.liquibase:liquibase-core:3.3.2'
// compile 'org.apache.commons:commons-lang3:3.1'
// compile "org.grails.plugins:cookie-session:3.0.0"
runtime "org.postgresql:postgresql:9.4-1204-jdbc42"
//Own dependencies - End
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
问题肯定是
at asset.pipeline.AssetPipelineGrailsPlugin$_doWithSpring_closure1.doCall(AssetPipelineGrailsPlugin.groovy:104)
资产管道插件。我比较确定插件已更新以解决此问题。
https://github.com/bertramdev/asset-pipeline/issues/145
看起来已在 2.13.2 中修复
我调整了 build.gradle 中的资产块并添加了 minifyOptions。这是它的样子
assets {
minifyJs = true
minifyCss = true
minifyOptions = [
languageMode: 'ES6'
]
}
仅供参考:与 Grails 3.3.2 有同样的问题
我的解决方案是:
compile ('org.grails.plugins:quartz-monitor:1.3'){
exclude group: 'org.grails.plugins', module: 'asset-pipeline'
}
因为quartz-monitor插件里面有老版本的asset-pipeline依赖
当我尝试在从 3.2.9 升级到 3.3.0.RC1(在我的本地环境中工作正常)后部署我的应用程序时,出现以下错误消息。 我在 tomcat 8.0.20、8.0.28 和 8.5.16 中尝试过。有人知道可能出了什么问题吗?
欢迎随时询问更多信息。
2017-07-05 11:28:52.960 INFO --- [ost-startStop-2] fnx1.ApplicationLoader : Starting ApplicationLoade
r on krake08.fzi.de with PID 2015 (/usr/lib/apache-tomcat-8.5.16/webapps/ROOT/WEB-INF/classes started by root in /usr/li
b/apache-tomcat-8.5.16)
2017-07-05 11:28:52.966 DEBUG --- [ost-startStop-2] fnx1.ApplicationLoader : Running with Spring Boot
v1.5.4.RELEASE, Spring v4.3.9.RELEASE
2017-07-05 11:28:52.966 INFO --- [ost-startStop-2] fnx1.ApplicationLoader : The following profiles ar
e active: production
2017-07-05 11:28:57.013 ERROR --- [ost-startStop-2] o.s.boot.SpringApplication : Application startup faile
d
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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:408)
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(GrailsApplicationPostProc
essor.groovy:171)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostPro
cessorRegistrationDelegate.java:118)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplic
ationContext.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:83)
at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
at org.grails.boot.context.web.GrailsAppServletInitializer.createRootApplicationContext(GrailsAppServletInitiali
zer.groovy:57)
...
非常感谢!
编辑:我附加了我的 build.gradle 文件。也许这有助于解决问题。
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
maven { url "http://dl.bintray.com/grails/plugins" }
maven { url "http://dl.bintray.com/zyro/maven" } //Websocket
maven { url "http://dl.bintray.com/jamescookie/plugins" } //Quartz Monitor
maven { url "http://download.java.net/maven/2/" }
maven { url "http://repo.spring.io/milestone/" }
maven { url "http://mvnrepository.com/artifact/" }
maven { url "https://mvnrepository.com/artifact/org.apache.commons/commons-lang3" } //StringEscapeUtils
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
// classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.5.0'
// classpath 'org.grails.plugins:asset-pipeline:3.2.1'
classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.2"
classpath "org.grails.plugins:hibernate4:5.0.0" //hibernate:4.3.10.7
}
}
//plugins {
// id "io.spring.dependency-management" version "0.5.2.RELEASE"
//}
version "1.0.0"
group "fnx1"
apply plugin: "org.springframework.boot"
apply plugin: "war"
apply plugin: "asset-pipeline"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
set "tomcat.version", "8.5.5"
}
assets {
minifyJs = true
minifyCss = true
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
provided "org.springframework.boot:spring-boot-starter-tomcat"
// compile "org.grails:grails-dependencies"
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-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding" //runtime
compile "org.grails.plugins:hibernate5"
compile "org.grails.plugins:async"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:events"
compile "org.hibernate:hibernate-ehcache"
compile "org.hibernate:hibernate-core:5.1.5.Final"
compile "org.grails.plugins:gsp"
console "org.grails:grails-console"
console "org.grails:grails-console"
profile "org.grails.profiles:web:3.1.0" //new
compile "javax.xml.soap:saaj-api:1.3.4"
compile "com.sun.xml.messaging.saaj:saaj-impl:1.3"
// compile "org.grails.plugins:asset-pipeline:3.2.1" //:3.2.1
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.2"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1'
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
//Own dependencies - Start
// compile 'org.grails.plugins:spring-security-core:3.1.1'
compile 'org.grails.plugins:spring-security-core:3.2.0.M1'
// compile 'org.grails.plugins:spring-security-appinfo:3.0.0'
compile 'org.grails.plugins:quartz:2.0.12'
// compile 'org.grails.plugins:quartz-monitor:1.3'
// compile 'org.grails.plugins:mail:2.0.0.RC6'
compile 'org.grails.plugins:grails-spring-websocket:2.3.0'
// compile 'org.grails.plugins:database-migration:2.0.0.RC1'
// compile 'org.liquibase:liquibase-core:3.3.2'
// compile 'org.apache.commons:commons-lang3:3.1'
// compile "org.grails.plugins:cookie-session:3.0.0"
runtime "org.postgresql:postgresql:9.4-1204-jdbc42"
//Own dependencies - End
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
问题肯定是
at asset.pipeline.AssetPipelineGrailsPlugin$_doWithSpring_closure1.doCall(AssetPipelineGrailsPlugin.groovy:104)
资产管道插件。我比较确定插件已更新以解决此问题。
https://github.com/bertramdev/asset-pipeline/issues/145
看起来已在 2.13.2 中修复
我调整了 build.gradle 中的资产块并添加了 minifyOptions。这是它的样子
assets {
minifyJs = true
minifyCss = true
minifyOptions = [
languageMode: 'ES6'
]
}
仅供参考:与 Grails 3.3.2 有同样的问题 我的解决方案是:
compile ('org.grails.plugins:quartz-monitor:1.3'){
exclude group: 'org.grails.plugins', module: 'asset-pipeline'
}
因为quartz-monitor插件里面有老版本的asset-pipeline依赖