Groovy Error: Unable to resolve class internal.GlobalVariable


#164

@Russ_Thomas I hope you kept a copy of your project so that new version can be tested against that :blush:.


#165

Of course. I have more backups than lines of test code :nerd_face:


#166

@Dung_Ngo, @devalex88, @Brandon_Hein

I’ve solved the issue. :sunglasses: I also can see the cause of the bug in Katalon, too. :nerd_face:

I’ll be back with more information once I’ve made the bug details clear to @devalex88.

Hopefully, this is the cause and/or a pointer to other similar issues as to why only some people get this problem and can’t upgrade in a timely manner.


#167

Thought I’d never see the day!!! Congrats! :tada:


#168

So. For whatever reason (too busy at the time; fog of war; sheer laziness) I didn’t bother looking in great detail at my globalvariables.groovy file when I sent it along to @devalex88 and the team to investigate. I certainly should have. Kicking myself now…

But let’s not get ahead of the story… here’s how it all went down, this morning…

I thought I’d give the KS 5.11 beta another try. Same issue as before. And the annoying thing, the Problems pane shows (showed) nothing.

Ah, but… it DID have something in it, but Katalon shows it as hidden on first heading in there. Click the header and all was revealed. Problem in GlobalVariables (surprise, surprise).

I double-clicked the entry and up popped the GV groovy file automagically produced by KS at startup of a test. It highlighted one particular variable:

"$WE_ACTIVE"

You’re ahead of me, now, right? :sunglasses:

In 5.4x (at least) that variable says:

'$WE_ACTIVE'

So, new mantra (to be adopted by the Katalon Devs, hopefully)

“Thou shalt not use double-quotes unless you can predict (or otherwise control) the content therein”

I sincerely hope this is the cause of many other failed upgrades.


Katalon version 5.4 test scripts, will it run to latest version 5.10?
#169

Hi, I am using Version: 5.10.1 (Build: 1) but still have the same issue. Does anyone know how to resolve it please…

19 Groovy:unable to resolve class internal.GlobalVar
21 Groovy:unable to resolve class internal.GlobalVariable
35 Groovy:unable to resolve class internal.GlobalVariable
19 Groovy:unable to resolve class internal.GlobalVar
21 Groovy:unable to resolve class internal.GlobalVariable
35 Groovy:unable to resolve class internal.GlobalVariable

Vik


#170

No, sorry! :tired_face:
Why would the double-quotes be the problem? Is it a Groovy thing?


#171

Sorry, I didn’t mean to be so obtuse…

GStrings are the problem. Groovy thinks it’s bumping into "${placeholder}… but when it doesn’t see { following $ it expects $ to be escaped. You (we, users) can’t escape strings in files over which you have no control…

Someone switched the quotes from to " in a template used by Katalon. Hence the mantra… :sunglasses:


#172

Ok :+1:

I think I got it.


#173

Any progress on this issue?

I’m on 5.10.1 Build 1 on a windows 10 machines and seeing this error when running from command line only. Have tried the various suggestions (deleting bin, libs, etc… checking to make sure that the gitignore is set up correctly) but it’s still persisting.


#174

I tried the suggestion from @Russ_Thomas changing " to ’ and @Brandon_Hein deleting some folders but I still get the same issue… and it was random… The only thing I remember doing beforehand is removing one of an obsolete Global variable (Profile) file and hitting the “Clean up” function :frowning:
I am using 5.10.1


#175

Ok, I got the UI scripts working by doing the following sequence:

  1. Removing the bin, Libs, .classpath and .project as suggested by @Brandon_Hein
  2. Modifying GlobalVariable.groovy from " to as suggested by @Russ_Thomas

So now it works for UI scripts. However, my API (services) scripts are still not working with error below:

javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: **Unable to resolve imported document at 'http://${url}/FTACTR/services?wsdl'.: java.net.UnknownHostException: ${url}**
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
	at com.kms.katalon.core.webservice.common.SoapClient.parseWsdl(SoapClient.java:83)
	at com.kms.katalon.core.webservice.common.SoapClient.send(SoapClient.java:142)
	at com.kms.katalon.controller.WebServiceController.sendRequest(WebServiceController.java:107)
	at com.kms.katalon.composer.webservice.parts.SoapServicePart$4.run(SoapServicePart.java:232)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: java.net.UnknownHostException: ${url}
	at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
	... 6 more

My ${url} is set from the GlobalVariable and gives the error as per attached.

However, if I put the actual WSDL URL, it works.


#176

Groovy string interpolation works with “${ }” but not with ‘${ }’. Can you work around that?


#177

@Evan

Please take your post to another thread, it’s off topic here.

Thanks.

EDIT: Sorry. I think I misread a post here. I’ll delete this at some point.


#178

I don’t think it’s “off topic”. The error above is when I click “Test Request and Verify” on the actual “Web Service” which I believe would help the katalon developers find the root cause better. To prove this, when I run the same API script under a “test case”, I get EXACTLY the same error as the OP posted:

Reason:
java.lang.NoClassDefFoundError: Could not initialize class internal.GlobalVariable
	at CUBNK - Transfer Funds via Web Service.run(CUBNK - Transfer Funds via Web Service:30)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)

I am happy to create a new topic if that is the rule here but I’m sure it will lead me back to the same thread.


#179

Still?!?!?
I can run the console in any environment but the docker container. How is this still a problem since katalon 5.4.

None of the solutions above even make any sense??

@Russ_Thomas says there is something like “$WE_ACTIVE” in my GlobalVariables.groovy, but I have no idea what that is about.

I also noticed in the logs the global variables are loaded after the keywords. See my logs:

Delete folder: bin
Delete folder: Libs
Opening project file: /Users/me/Katalon Studio/katalon-ci/katalon-ci.prj
Request sent successfully.
Parsing custom keywords...
/%Users%me%Katalon Studio%katalon-ci%katalon-ci.prj/Keywords/com/example/util/FileReader.groovy: 19 
Groovy:unable to resolve class internal.GlobalVariable
Generating global variables...
/%Users%me%Katalon Studio%katalon-ci%katalon-ci.prj/Test Listeners/ExampleListener.groovy: 16 
Groovy:unable to resolve class internal.GlobalVariable
Project 'katalon-ci' opened

#180

Afraid so.

  1. None of the solutions above work for me, except my own but Katalon then breaks itself again.
  2. They all make sense.

I never said you had a copy of my global variable inside your global variables file. You “have no idea what that is about” because you do not understand the problem, nor, it seems, what a global variable is.

Crickets.

Why? What’s your point? What is your question? What are you suggesting as a fix?