尝试使用Grails的Quartz插件编译错误

时间:2014-03-18 14:02:08

标签: grails quartz-scheduler

我正在尝试安装和使用Grails' Quartz plugin。我的Grails'版本是2.3.7

我在我的Build.config中添加了compile ":quartz:1.0.1"; 并下载了quartz-2.2.1.jarquartz-jobs-2.2.1.jar;然后将这些.jar文件添加到我的/lib文件夹中。

当我尝试grails run-app时,会出现以下错误:

Compile error during compilation with javac.
C:\Users\username\Documents\NetBeansProjects\Siscoserv-web\target\work\plugins\quartz-1.0-RC11\src\java\grails\plugins\quartz\CustomTriggerFactoryBean.java:51: error: inconvertible types
        if(customTrigger instanceof AbstractTrigger){
           ^
  required: AbstractTrigger
  found:    Trigger
C:\Users\username\Documents\NetBeansProjects\Siscoserv-web\target\work\plugins\quartz-1.0-RC11\src\java\grails\plugins\quartz\CustomTriggerFactoryBean.java:52: error: inconvertible types
            AbstractTrigger at =(AbstractTrigger) customTrigger;
                                                  ^
  required: AbstractTrigger
  found:    Trigger
C:\Users\username\Documents\NetBeansProjects\Siscoserv-web\target\work\plugins\quartz-1.0-RC11\src\java\grails\plugins\quartz\CustomTriggerFactoryBean.java:56: error: no suitable method found for setJobKey(Key)
                at.setJobKey(jobDetail.getKey());
                  ^
    method AbstractTrigger.setJobKey(JobKey) is not applicable
      (actual argument Key cannot be converted to JobKey by method invocation conversion)
    method MutableTrigger.setJobKey(JobKey) is not applicable
      (actual argument Key cannot be converted to JobKey by method invocation conversion)

当我尝试安装插件并运行Grails时,run-app期间出现以下错误:

|Compiling 216 source files
.Error 
|
Fatal error during compilation org.apache.tools.ant.BuildException: java.lang.IncompatibleClassChangeError: Implementing class (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.IncompatibleClassChangeError: Implementing class
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.codehaus.gant.GantBuilder.invokeMethod(GantBuilder.java:99)
    at _GrailsCompile_groovy$_run_closure3_closure8_closure9.doCall(_GrailsCompile_groovy:61)
    at _GrailsCompile_groovy$_run_closure3_closure8_closure9.doCall(_GrailsCompile_groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at _GrailsCompile_groovy.withCompilationErrorHandling(_GrailsCompile_groovy:68)
    at _GrailsCompile_groovy.this$4$withCompilationErrorHandling(_GrailsCompile_groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:168)
    at _GrailsCompile_groovy$_run_closure3_closure8.doCall(_GrailsCompile_groovy:60)
    at _GrailsCompile_groovy$_run_closure3_closure8.doCall(_GrailsCompile_groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at _GrailsCompile_groovy$_run_closure3.doCall(_GrailsCompile_groovy:57)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
    at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
    at _GrailsCompile_groovy$_run_closure2.doCall(_GrailsCompile_groovy:44)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:168)
    at _GrailsPackage_groovy$_run_closure2_closure8.doCall(_GrailsPackage_groovy:42)
    at _GrailsPackage_groovy$_run_closure2_closure8.doCall(_GrailsPackage_groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:41)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
    at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
    at RunApp$_run_closure1.doCall(RunApp.groovy:28)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners$0.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:591)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
Error |
Fatal error during compilation org.apache.tools.ant.BuildException: java.lang.IncompatibleClassChangeError: Implementing class

我在上面的错误中没有删除该班级的名字,它只是没有出现。

3 个答案:

答案 0 :(得分:5)

我发现了问题所在: 似乎shiro有石英作为依赖,它下载的版本与石英插件使用的版本不同。

我修复了它,将以下excludes语句添加到我的Build.config

compile (":shiro:1.2.0") {
            excludes([name: 'quartz', group: 'org.opensymphony.quartz'])
}

我通过创建一个新项目并启用了石英插件,然后其他人使用某种二进制搜索找到了问题,直到找到问题为止。

答案 1 :(得分:2)

如果您已将插件安装为

compile ":quartz:1.0.1"

版本1.0.1,那你为何会从quartz-1.0-RC11收到错误。来自stacktrace:

C:\Users\username\Documents\NetBeansProjects\Siscoserv-web\target\work\plugins\
quartz-1.0-RC11\src\java\grails\plugins\quartz\CustomTriggerFactoryBean.java:51: 
error: inconvertible types

删除traget目录,从本地.m2(本地maven repo)删除旧版石英,从应用程序中删除其他引用(如.grails\app\..),如果有的话然后运行grails clean && grails compile,它应该是好的。

我没有看到使用基于2.3.7构建的grails应用程序编译插件的任何问题。

答案 2 :(得分:1)

从lib目录中删除JAR文件。你不需要它们。该插件将提供所有必需的JAR。这是Grails插件系统的优点之一。将这些JAR添加到lib目录会导致冲突。

相关问题