2

我正在尝试将 grails-app (2.2.4) 部署到 JBoss AS 7.1.1。

我通过 构建了我的 war 文件grails war,将其复制到了独立/部署目录,并使用 bin/standalone.bat 启动了 JBoss。

到目前为止一切正常,可以通过浏览器访问该站点。但应用程序的一部分是应从 FTP 服务器加载文件的石英作业。

它按预期定期启动,但由于以下错误而失败:

ERROR [grails.plugins.quartz.listeners.ExceptionPrinterJobListener] (quartzScheduler_Worker-6) Exception occurred in job: null: org.quartz.JobExecutionException: java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildLogger [See nested exception: java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildLogger]
    at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:96) [classes:]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-2.1.5.jar:]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-2.1.5.jar:]
Caused by: java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildLogger
    at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_03]
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) [rt.jar:1.7.0_03]
    at java.lang.Class.getDeclaredConstructors(Class.java:1853) [rt.jar:1.7.0_03]
    at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69) [groovy-all-2.0.8.jar:2.0.8]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_03]
    at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:187) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.ExpandoMetaClass.<init>(ExpandoMetaClass.java:297) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.ExpandoMetaClass.<init>(ExpandoMetaClass.java:340) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.ExpandoMetaClassCreationHandle.createNormalMetaClass(ExpandoMetaClassCreationHandle.java:46) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) [groovy-all-2.0.8.jar:2.0.8]
    at projectname.MessungImportJob$_ftpFileRetrieval_closure1.doCall(MessungImportJob.groovy:183) [classes:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_03]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_03]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_03]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_03]
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1082) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1106) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.Closure.call(Closure.java:412) [groovy-all-2.0.8.jar:2.0.8]
    at groovy.lang.Closure.call(Closure.java:425) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1326) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1298) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.dgm$148.invoke(Unknown Source) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) [groovy-all-2.0.8.jar:2.0.8]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) [groovy-all-2.0.8.jar:2.0.8]
    at projectname.MessungImportJob.ftpFileRetrieval(MessungImportJob.groovy:115) [classes:]
    at projectname.MessungImportJob$ftpFileRetrieval.callCurrent(Unknown Source)
    at projectname.MessungImportJob.execute(MessungImportJob.groovy:77) [classes:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_03]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_03]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_03]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_03]
    at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:89) [classes:]
    ... 2 more
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildLogger from [Module "deployment.projectname-0.1.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    ... 54 more

我想这是一个相当基本的 Java 问题,但是:我必须在某处包含这个 org.apache.tools.ant-library 吗?我必须在 grails-configs 的某个地方“列出”它吗?还是我完全错过了其他东西?

以开发者模式 ( grails run-app) 启动它可以正常工作。

谢谢你的建议,马吕斯

4

1 回答 1

2

我在这个网站上找到了原因和解决方案:http: //grails.org/plugin/grails-ant

尽管 ant 是 Grails 核心的一部分,但由于它主要是一个构建工具,它不包含在 Grails 战争文件中 (1)。你可以在你自己的应用程序中做到这一点,没有这个插件,通过将 ant 添加到你的 build.config 中。

dependencies {
    // Workarounds for Grails not shipping ant in WAR
    compile 'org.apache.ant:ant:1.7.1'    //you can also use runtime
    compile 'org.apache.ant:ant-launcher:1.7.1' 
}

我从这里将版本更改为最新版本,然后 JBoss 启动它。

感谢 tim_yates 的第一个提示。

于 2013-09-09T12:29:49.870 回答