@Russ_Thomas I hope you kept a copy of your project so that new version can be tested against that .
Of course. I have more backups than lines of test code
@YoungNgo, @devalex88, @Brandon_Hein
Iāve solved the issue. I also can see the cause of the bug in Katalon, too.
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.
Thought Iād never see the day!!! Congrats!
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?
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.
UPDATE:
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
No, sorry!
Why would the double-quotes be the problem? Is it a Groovy thing?
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ā¦
Ok
I think I got it.
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.
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
I am using 5.10.1
Ok, I got the UI scripts working by doing the following sequence:
- Removing the bin, Libs, .classpath and .project as suggested by @Brandon_Hein
- 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.
Groovy string interpolation works with ā${ }ā but not with ā${ }ā. Can you work around that?
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.
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
Afraid so.
- None of the solutions above work for me, except my own but Katalon then breaks itself again.
- 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?
I really donāt know what is wrong, I just panicked a bit, I have learned some things though. Iāve spent entirely too much time just trying to figure out what is causing the problem. All I know is when I run a test in docker, I get an error which says my internal.GlobalVariables
canāt be resolved. Starting to think this error is about as specific as a NullPointerException
.
About my logs I posted before, just started thinking, maybe its the order of operations. It clearly shows the CustomKeywords
are parsed and compiled before the GlobalVariables
. Probably not the issue though because the same command works on dev machines. Maybe it works on local machine because the ./bin
is already made and therefore the globals would exist prior to the CustomKeywords
, whereas a Docker container builds it all from scratch.
The only solution I can think of that I have not tried is; maybe the CustomKeywords
should simply not use the internal.GlobalVariables
. In my case at least, only CustomKeywords
using the GlobalVariables implemented in the Listeners before and after methods fail with canāt resolve the Globals. Oddly enough, the test cases I ran all passed and they are all using the global variables. Itās just the Listeners do not run our before and after scripts because of the issue.
Here are a few things I found out in the course of battle. No solutions here but things to watch out for which may or may not cause can't resolve the internal.GlobalVariables
.
-
When I import a katalon project to eclipse, the
.project
file is modifed. Then when you run through terminal you will get a whole bunch of weird and non fatal errors before everything runs fine. Katalon can regenerate the.project
file if you delete it. -
If you were to delete and recreate any of the directories which come with a new katalon project, running through terminal will cause bad errors. For example, I deleted the
Test Listeners
directory and copied it back from another project. From then on I get even more instances ofinternal.GlobalVariable can't be resolved
, even in theTest Cases
. -
Iām very suspicious of adding Groovy files outside of Katalon, i.e. from eclipse. Itās hard to confirm this causes issues though. Seems like a similar issue to the directory issue above.
-
Back to the deleting and recreating the default dirs, we do not commit our configs from the
Profiles
dir. In our CI build wemkdir Profiles
and curl in a snippet containing the profile/config. Then the CI build simply uses default.glbl as the profile which can be different values depending on which one we injected with curl. -
You can get issues sometimes when upgrading katalon to new version. I tried copying code from a project which was originally created in a previous version to a brand new project made by the new version. All of a sudden the console output was cleaner. Probably nothing to do with this issue though.
As mentioned earlier, I have no solutions yet, however Iām getting closer. Hopefully my story can help someone get closer to the real problem.
I just tried running the Katalon for linux using a JDK and the same exact issue I get with the docker container. I DO NOT have much more time to put into this
I know. We can all come up with crazy notions ā easiest when weāre pulling our hair out. But itās usually a good idea to take a step back and remind yourself, if that were the case, nobodyās Katalon system would work because everybody would be suffering from the same problem.
So, unless you want to spend a month or two with Alice, stay the hell out of the Rabbit Hole ā¢.
Sounds like the solution for most people in this thread is time. Iāll pray for some other brave and legendary soul to battle the Jabberwocky in Neverland. Iām simply baffled it works so well on Mac and Windows with no errors and then all hell breaks loose on Linux.
In the mean time I have confirmed that no matter what you do, even if everything works, you will indeed get the error when running in a container. Now Iām thinking this may not even be the error for my issue. I definitely think they are related though. Basically itās just the test listeners which wonāt run before or after the test case. Now for whatever reason I get this new error during my before listener.
2019-02-21 16:20:18.472 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - ? java.lang.ExceptionInInitializerError
2019-02-21 16:20:18.473 ERROR c.k.k.core.context.internal.TestHooker - ? com.kms.katalon.core.exception.StepErrorException: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.ExceptionInInitializerError
Probably not helpful for advice, at least itās something different and it happened right on some code which made me question some things. It almost seems like the listener is tripping out on the first line which uses CustomKeywords
. The Listeners donāt seem to care that CustomKeywords
was not imported, however I have had to import it manually elsewhere like so: Class CustomKeywords = Class.forName('CustomKeywords')
. However, Iām pretty certain this is not the issue.
Hmmm . . . I have some more tests to test our tester testing our apps.
My solution in times of hopeless bug battles is to refactor the problem code a whole new way, i.e. hack the shit out of it. Iāll just move the code in the listeners before and after each and every test-case, nice and hacky but it should work for now. If not, something is probably wrong with one of our Keywords.
Iāll let yaāll know if I come across anything else to help.
Good luck yaāll!