[英]No signature of method: org.codehaus.groovy.runtime.GStringImpl.split()
Error Message: 错误信息:
No signature of method: org.codehaus.groovy.runtime.GStringImpl.split()
is applicable for argument types: (java.lang.String) values: [:]
Possible solutions: split(), split(), split(groovy.lang.Closure),
plus(java.lang.String), wait(),toList()
Code snippet: 程式码片段:
static getRosterId(def session) {
session.filter?.split(':')[0]
}
static getSubject(def session) {
session.filter?.split(':')[1]
}
JDK: JDK:
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Grails Version: Grails版本:
2.0.1
Ubuntu Version: Ubuntu版本:
Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic x86_64)
this is doing a split on what should be a normal String... of course it's a GString while in grails, this code works in production, on our local boxes, but does not work on our CI Ubuntu server.... not sure why Grails wouldn't be able to resolve String methods in this particular environment, we are not doing anything special in this class, no String.metaClass manipulation... straight Grails. 这正在对应该是普通String的内容进行拆分...当然,这是GString,而在grails中,此代码可以在生产环境中,在我们的本地机器上使用,但在我们的CI Ubuntu服务器上不可用...。不确定为什么Grails在这种特定环境下无法解析String方法,我们在此类中没有做任何特别的事情,没有String.metaClass的操作……直接Grails。
Any input would be awesome 任何输入都会很棒
Our final fix was 我们的最终解决方法是
static getRosterId(def session) {
session.filter?.toString().split(':')[0]
}
static getSubject(def session) {
session.filter?.toString().split(':')[1]
}
This should not be needed in Groovy! 在Groovy中不需要此功能! :( a GStringImpl Object should resolve all GString and java.lang.String methods :/
:( GStringImpl对象应该解析所有GString和java.lang.String方法:/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.