Unable to resolve class internal.GlobalVariable (Again)

I setup KTL project to run it on Jenkins but got the issue about Groovy: “unable to resolve class internal.GlobalVariable”

Does anyone know how to fix this issue? I’m using Chrome version 72 + KTL 6.1.0

My command as below:
katalon -runMode=console -projectPath=“E:\Protractor workspace\Katalon\Katalon.prj” -reportFolder=“Reports” -reportFileName=“report” -retry=0 -testSuiteCollectionPath=“Test Suites\General_Collection” -browserType=“Chrome”

Did you try searching?

http://forum.katalon.com/search?q=internal.GlobalVariable%20jenkins

I did it, all of them talked that this issue of version Katalon, but i’m using newer version (6.1.0) so I raised my question to get lastest answer.

I am on 6.1.5 & still see this issue… Can someone please assist
No such property: GlobalVariable for class: internal.GlobalVariable

You can try to close and open Katalon again, i did this way to fix it

I’ve just been removing the call to import internal.GlobalVariable from any of my keyword (classes) that don’t need them to reduce the clutter. All it seems to be used for is to pull the value from the Profile that was selected. I don’t understand why every keyword is assigned that as an import by default if it’s not needed.

While it reports the error has it ever gotten in the way of your test execution? I’ve given up on getting any actual input as to why it’s being called, or any directions that don’t require me to manually recompile parts of the base Katalon studio.

1 Like

I had the problem too, but it wasn’t only internal.GlobalVariable. I also had it with custom keywords.

My solution is to reduce the imported classes to only I needed. I did this by pressing STRG+SHIFT+O.

After that I didn’t get the error anymore.

What is the “STRG” key ?

Oh sorry, German keyboard :wink:

The shortcut is CTRL + SHIFT + O

1 Like

there are plenty discussions on the GlobalVariable class voodo.
some were serious, some were solved.
but even in the last version, the import of the internal global blah class when generating a new keyword is there …

perhaps i missunterstud some concepts but, i will ask again the development team and other god users:

“why would somebody want to use global variables by default in a keyword class? aka why the template is adding that import by default?”

@devalex88 @Trong_Bui @Russ_Thomas @kazurayam @anyone_else_with_better_java_understanding

after we find the answer, the second question:
“why don’t we have a feature to propose class optimization when hitting save … aka get rid of unused imports?”

may be usefull for scripts too … just saying …

Maybe some developer create a plugin with this functionality, if the katalon core development team don’t like it?

1 Like

ooor maybe some developers should start to use linters? in python,with decent level settings,such issue will never pass a pull request …

Oh please… I’m not a “god user”. My use and expertise within Katalon Studio is very limited. But thanks for the compliment :blush:

And guess what… I’m getting the same error (yet again). But this time, it has me completely stumped - it makes no sense (at least, I can’t make sense of it).

I have a couple of suites that run fine in the IDE and via CLI. They work fine on TWO different machines. On a third and fourth machine,

Generating global variables...
/D%%softwareDev%branches%2018.05.15.stableRelease.RelBranch%KatTests%xxx V9%
xxx v9.prj/Keywords/com/xxxx/base/baseGrid.groovy: 12 Groovy:unable to resolve class internal.GlobalVariable

And a ton more just like that.

Call out to other god users @Brandon_Hein @Marek_Melocik @Andrej_Podhajsky @YoungNgo

(Win10, Win7, Win8, KS 6.1.2)

My guess: This is just their way of trying to reduce the complexity for new users, who may or may not have a firm understanding of how to import things themselves. This would also support users who do a lot of record/playback.

Your argument could be said about ALL of the default imports.

2 Likes

Hmmm again, I think the root of this problem comes down to how Katalon is invoked from CLI. In the old days, I think that the user was required to open their project in the studio at least once on the target machine, which would allow the compiler to do its thing (including generating the binary of the GlobalVariable.groovy file). More recently, I believe that the command now attempts to do this for you. I will look at this more closely when I get into the office :upside_down_face:

2 Likes

let’s focus first on the anoying one. later we can discuss what can be further improved. thank you for your dedication :slight_smile:

in the eyes of visual impaired, the one eye is ‘seen’ like a god :smiley:

Oh I totally agree that it’s annoying (actually, a better word would be “unnecessary” imo). If it were up to me, new keywords would not import anything by default at all. I was simply giving my guess to the answer for your question of:

Here’s a snippet of the console log from a Jenkins execution on a remote machine:

[EL Warning]: 2019-06-18 00:00:50.656–Ignoring attribute [lastRun] on class [TestSuiteEntity] as no Property was generated for it.
Delete folder: bin
Delete folder: Libs
Opening project file: C:\projects\qa-katalon\master.prj
Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified
166 2.4.7.xx-201611170128-e46 = ACTIVE
Proxy found for HTTP @ 192.168.11.17:8080.
Request sent successfully.
Parsing custom keywords…
00:00:57.859 [Worker-0] DEBUG org.eclipse.jgit.util.FS - readpipe [git, --version],C:\Users\hei09463\Desktop\Brandon’s Folder\Git\cmd
00:00:58.155 [Worker-0] DEBUG org.eclipse.jgit.util.FS - readpipe may return ‘git version 2.17.0.windows.1’
00:00:58.155 [Worker-0] DEBUG org.eclipse.jgit.util.FS - remaining output:

00:00:58.155 [Worker-0] DEBUG org.eclipse.jgit.util.FS - readpipe [git, config, --system, --edit],C:\Users\hei09463\Desktop\Brandon’s Folder\Git\cmd
00:00:58.390 [Worker-0] DEBUG org.eclipse.jgit.util.FS - readpipe may return ‘C:/Users/hei09463/Desktop/Brandon’s Folder/Git/mingw64/etc/gitconfig’
00:00:58.390 [Worker-0] DEBUG org.eclipse.jgit.util.FS - remaining output:

Generating global variables…
Project ‘master’ opened

As I suspected, katalon.exe attempts to recompile your project at runtime (see bold lines from above). I wonder if, when you run from CLI on the machine(s) you are having issues with, that the log doesn’t contain these lines… Maybe there are errors?

Also FYI, I’m still using an older version of the studio (5.10.1) in the above log. Slap on the wrist… I know… :confused: