ERROR:groovy.lang.MissingMethodException: No signature of method
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ERROR:groovy.lang.MissingMethodException: No signature of method
I have groovy util class as below:
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:
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.
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)
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
def sqlcommand = 'SELECT id From configs_account Where name = \'APITEST_NewAccount_ValidData_ACTIVE\''
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Replace "static method" of JDBC Connection class with “construction method” ,it worked!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's great to hear this, @Melissa!
Olga Terentieva
SmartBear Assistant Community Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, try to new a instance instead of "static" class should be a temp solution, but why some "static" method works well but the others throws exception here, I'm still confused, still waitting for root cause...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you change the definition of sqlcommand as @nmrao suggested?
def sqlcommand = 'SELECT id From configs_account Where name = \'APITEST_NewAccount_ValidData_ACTIVE\''
Do you get the same error now? Can you please provide us with the new stack trace?
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you used single quote or double quote at the end of the statement?
Can you please post stacktrace of the error?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks everyone for participation!
@白夜有点黑, what stage are you on now? Have you managed to find a solution?
Olga Terentieva
SmartBear Assistant Community Manager
