简体   繁体   English

错误:groovy.lang.MissingMethodException:没有方法签名

[英]ERROR:groovy.lang.MissingMethodException: No signature of method

I have groovy util class as below:我有如下 groovy util 类:

package com.hypers.test.apitest.util

import groovy.sql.Sql

class DataBaseUtil {

    static def database

    static def connectDB(def url, def username, def password, def driver){
        database = Sql.newInstance(url,username,password,driver)
    }

    static def queryData(def sqlcommand){
        database.rows(sqlcommand)
    }

    static def queryData(def sqlcommand, def offset, def pageSize){
        database.rows(sqlcommand, offset, pageSize)
    }

    static def getFirstRow(def sqlcommand){
        database.firstRow(sqlcommand)
    }

    static def updateData(def sqlcommand){
        database.executeUpdate(sqlcommand)
    }

    static def insertData(def sqlcommand){
        database.executeInsert(sqlcommand)
    }

    static def deleteData(def sqlcommand){
        database.execute(sqlcommand)
    }

    static def closeDB(){
        database.close()
    }
}

I copied it to SoapUI for a reference, like:我将其复制到 SoapUI 以供参考,例如:

package com.hypers.test.apitest.util

def JDBC_URL = context.expand( '${#Project#JDBC_URL}' )
def DB_UserName = context.expand( '${#Project#DB_UserName}' )
def DB_Password = context.expand( '${#Project#DB_Password}' )
def DB_Driver = context.expand( '${#Project#DB_Driver}' )

def sqlcommand = "SELECT id From configs_account Where name = 'APITEST_NewAccount_ValidData_ACTIVE'"

DataBaseUtil.connectDB(JDBC_URL, DB_UserName, DB_Password, DB_Driver)
DataBaseUtil.queryData(sqlcommand)
DataBaseUtil.getFirstRow(sqlcommand)

It works well with queryData method, but it's throws exception with getFirstRow method, I really can't figure out what's going on and get blocked for a very long time, please help to have a look, thanks.它与queryData方法配合良好,但使用getFirstRow方法抛出异常,我真的无法弄清楚发生了什么并且被阻塞了很长时间,请帮忙看看,谢谢。

Exception as below:异常如下:

Tue Jul 23 15:48:47 CST 2019:ERROR:groovy.lang.MissingMethodException: No signature of method: static com.hypers.test.apitest.util.DataBaseUtil.getFirstRow() is applicable for argument types: (java.lang.String) values: [SELECT id From configs_account Where name = 'APITEST_NewAccount_ValidData_ACTIVE']
   groovy.lang.MissingMethodException: No signature of method: static com.hypers.test.apitest.util.DataBaseUtil.getFirstRow() is applicable for argument types: (java.lang.String) values: [SELECT id From configs_account Where name = 'APITEST_NewAccount_ValidData_ACTIVE']
    at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1373)
    at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1359)
    at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:50)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at com.hypers.test.apitest.util.DBUtil.getFirstRow(Script10.groovy:38)
    at com.hypers.test.apitest.util.DBUtil$getFirstRow.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at Script18.run(Script18.groovy:10)
    at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
    at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:79)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:138)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

try尝试

def database = DataBaseUtil.connectDB(JDBC_URL, DB_UserName, DB_Password, DB_Driver)
def rows = database.queryData(sqlcommand)
def row = database.getFirstRow(sqlcommand)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Groovy:groovy.lang.MissingMethodException:方法未签名 - Groovy : groovy.lang.MissingMethodException: No signature of method 捕获:groovy.lang.MissingMethodException:没有方法的签名 - Caught: groovy.lang.MissingMethodException: No signature of method jenkinspipeline groovy.lang.MissingMethodException:没有方法签名 - jenkinspipeline groovy.lang.MissingMethodException: No signature of method groovy.lang.MissingMethodException:没有方法解析的签名 - groovy.lang.MissingMethodException: No signature of method resolution groovy.lang.MissingMethodException:没有方法的签名: - groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingMethodException:没有方法签名 - groovy.lang.MissingMethodException: No signature of method groovy.lang.MissingMethodException:肥皂中没有方法--groovy脚本的签名 - groovy.lang.MissingMethodException:No signature of method --groovy script in soap groovy.lang.MissingMethodException:groovy脚本中没有方法签名 - groovy.lang.MissingMethodException: No signature of method in groovy script groovy.lang.MissingMethodException:方法的无签名:在詹金斯构建流程的groovy中 - groovy.lang.MissingMethodException: No signature of method: in groovy on jenkins buildflow 如何解决问题groovy.lang.MissingMethodException:没有方法的签名: - how to resolve the issue groovy.lang.MissingMethodException: No signature of method:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM