We are trying to migrate to Katalon 8.3.5 from Katalon 7.7. 2. On executing any test case in Katalon 8.3.5 I am getting the message ‘’ java.lang.SecurityException: Prohibited package name: java.lang"

We are trying to migrate to Katalon 8.3.5 from Katalon 7.7. 2. On executing any test case in Katalon 8.3.5 I am getting the message ‘’ java.lang.SecurityException: Prohibited package name: java.lang"

java.lang.string is not used in our keywords, but is generated in .cache on opening the project in katalon 8.3.5

Console log:
java.lang.SecurityException: Prohibited package name: java.lang
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:656)
at java.lang.ClassLoader.defineClass(ClassLoader.java:755)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:175)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:175)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:138)

Close your project and manually delete the following from your project:

  • the bin and Libs folders
  • the ‘hidden’ .cache and .settings folders
  • the ‘hidden’ .classpath and .project files

and re-open your project in the new Katalon. All from above will be properly re-generated.

I have already tried these steps. But after opening the project in Katalon 8.3.5; .cache folder is getting created with the package java.lang in some of the keywords

this is the time when you have to share your code.
seriously, your new cache contains stuff which are not present in your code?
hard to accept such, at least from my side…

cadence__com__sorting.cache (4.1 KB)
sorting.groovy (9.3 KB)

Sorting.groovy is our keyword and the other one is from katalon .cache folder

This is odd …

                "fullClassName": "java.lang.String",
                "unresolvedClassName": "String",

Apparently, is generated at compile time from the method declaration (which looks OK at first look):

	def sortIntegerAscending(String xpath_List){

I will try to import your keyword to see If i can reproduce the issue when I find some time.

What you can try in the mean time is, remove the String from the methods declaration.
Groovy works also without it, it will guess the parameter type.
Must dig also into some docs to see if any changes between groovy versions

LE: you can try also latest KS (8.4.0) … I have the feeling something has been changed in this version regarding cache …

well … i imported your keyword in 8.3.5 and made a simple testcase (is not using your keyword, have just a print)
I see the same generated in cache, but I got no errors when I ran my testcase.
So it must be something else specific with your environment …
side note, those three imports generated errors:

import MobileBuiltInKeywords as Mobile
import WSBuiltInKeywords as WS
import WebUiBuiltInKeywords as WebUI

but are not used in your class, so I had to remove them.
just hit Ctrl-Shift-O to make some cleanup in your scripts / keywords
LE: it works fine with 8.4.0 also …
So, it is not because what you see in the cache, but something else.

LLE: after i edited your keywords (removed the String type) i got something like this in the cache:

          "name": "sortdescendingcaseinsensitive",
          "parameters": [
            {
              "name": "xpath_List",
              "initialExpression": "",
              "type": {
                "fullClassName": "java.lang.Object",
                "unresolvedClassName": "java.lang.Object",
-----

So you can try that also, but i doubt it will fix the main issue
Somewhere you have a wrong import perhaps.
There are any errors shown in the Problems tab?

Thanks for your help.

I have already replaced those three import statements. That is fine now.

I removed .cache and searched for java.lang Its being used in some other places as well.

Commented out the lines wherever java.lang was being used. Still the error remains same.

no errors, only warnings.

replaced the import statements to remove the errors

The issue got resolved by removing these two files from driver folder

  • guava-20.0.jar

  • rt.jar

since Katalon includes those kinds of libraries already.

2 Likes