【发布时间】:2013-12-27 12:50:42
【问题描述】:
使用grails run-app 运行应用程序可以正常工作,但在 Tomcat 7 中部署后出现以下错误。
groovy.lang.MissingMethodException:
No signature of method: static com.digithurst.hdspro.web.Responder.respond()
is applicable for argument types: (ResourceListCmd, QueryCmd, groovy.util.ConfigObject)
values: [ResourceListCmd@5c380e, ...]
Possible solutions: respond(HttpResource, java.lang.Object, java.lang.String)
如前所述,这在 Tomcat 之外有效。调用方法的方式与实现方式完全相同。 ResourceListCmd 实现了接口HttpResource,这使它非常适合。如果第一个参数是null,也会出现这个错误。
groovy.lang.MissingMethodException:
No signature of method: static com.digithurst.hdspro.web.Responder.respond()
is applicable for argument types: (null, QueryCmd, groovy.util.ConfigObject)
values: [null, ...]
Possible solutions: respond(HttpResource, java.lang.Object, java.lang.String)
更多关于环境的信息:
- Windows 7 64 位
- Java 7 U45 x86
- Grails 2.3.4
- Tomcat 7.0.47
我已经清理了用户目录中的.grails和.m2文件夹,并在创建war文件之前执行了grails clean。
[H3rnst回答后编辑]
控制器:
def index() {
try {
ResourceListCmd configs = configService.search()
respond Responder.respond(configs, new QueryCmd(level: 'list'),
grailsApplication.config.grails.serverURL)
}
catch (Exception e) {
render status: INTERNAL_SERVER_ERROR
}
}
ResourceListCmd:
interface HttpResource {
...
}
abstract class AbstractHttpResource implements HttpResource {
...
}
class ResourceListCmd extends AbstractHttpResource {
...
}
响应者:
class Responder {
static def respond(HttpResource resource, def query, String serverURL) {
...
}
}
【问题讨论】:
-
是 run-war 还是 run-app 工作?
-
我没有尝试过
run-war(不知道那个命令),但是,正如开篇所说,run-app确实有效。 -
我遇到了类似的问题,run-app 运行良好,但 run-war 没有运行,你可以试试吗?
-
我当然可以,但这有什么帮助呢?不过,这必须等到星期一。