我正在尝试在Tomcat7上运行需要一些插件的Project,并且是用Grails编写的。
使用命令 grails prod war 创建-war会导致错误,告诉我不支持类型为[java.util.List]的参数。
我在哪里以及如何看到支持哪个参数以及为什么List不是?
包含错误的日志文件如下所示:
| Loading Grails 2.4.1
| Configuring classpath
| Configuring classpath.
| Environment set to production
| Environment set to production.
| Environment set to production..
| Environment set to production...
| Environment set to production....
| Environment set to production.....
| Packaging Grails application
| Packaging Grails application.
| Packaging Grails application..
| Packaging Grails application...
| Packaging Grails application....
| Packaging Grails application.....
| Compiling 70 source files
| Warning The [listFullAccessResources] action in [VsGrantController] accepts a parameter of type [java.util.List]. Interface types and abstract class types are not supported as command objects. This parameter will be ignored.
List listFullAccessResources(VsUser loggedInUser, List resultsGoups) {
^
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[groovyc] General error during class generation: java.lang.NoClassDefFoundError: Unable to load class org.jets3t.service.impl.rest.httpclient.RestS3Service due to missing dependency org/apache/http/client/methods/HttpHead
[groovyc]
[groovyc] java.lang.RuntimeException: java.lang.NoClassDefFoundError: Unable to load class org.jets3t.service.impl.rest.httpclient.RestS3Service due to missing dependency org/apache/http/client/methods/HttpHead
[groovyc] at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1083)
VsGrantController.groovy看起来像这样
import org.apache.commons.lang.StringUtils
class VsGrantController {
def vsAuthenticateService
def vsGrantService
def index = { redirect(action:list,params:params) }
// the delete, save and update actions only accept POST requests
static allowedMethods = [delete:'POST', save:'POST', update:'POST']
List listFullAccessResources(VsUser loggedInUser, List resultsGoups) {
// labels user has full access to
def cLabels = VsLabel.createCriteria()
def resultsLabelsFullAccess = cLabels.listDistinct {
grants {
and {
permission {
eq("name", 'Full')
}
or {
eq("accessor", loggedInUser)
if(resultsGoups) {
or {
for (g in resultsGoups) {
eq("accessor", g)
}
}
}
}
}
}
order("name")
}
我是Grails / Groovy Tomcat Webbapp主题的新手 所以我希望这个问题不是坏事
答案 0 :(得分:1)
警告“不支持接口类型和抽象类类型作为命令对象。”抱怨,因为您的控制器操作具有List resultsGoups
参数。这不受支持。
您可以从隐式“params”地图或使用command object中提取参数。
像这样......
def listFullAccessResources(AccessResourcesCommand cmd) {
}
class AccessResourcesCommand {
Bar loggedInUser
List resultsGroups
}
答案 1 :(得分:0)
您的实际错误是
Unable to load class org.jets3t.service.impl.rest.httpclient.RestS3Service due to missing dependency org/apache/http/client/methods/HttpHead
您需要在类路径中包含 httpclient.jar
答案 2 :(得分:-2)
将其更改为:
def List listFullAccessResources(VsUser loggedInUser, List resultsGoups)
你的警告会消失......