Error when run custom script

Test Cases/Get All Login FAILED.
Reason:
java.lang.IllegalArgumentException: Property ‘http://javax.xml.XMLConstants/property/accessExternalDTD’ is not recognized.
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(Unknown Source)
at com.kms.katalon.util.DocumentBuilderProvider.newBuilderInstance(DocumentBuilderProvider.java:16)
at com.kms.katalon.core.testobject.ResponseObject.getResponseBodyContent(ResponseObject.java:74)
at Get All Login.run(Get All Login:35)
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:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1623560722016.run(TempTestCase1623560722016.groovy:25)

I got an issue, other test cases run ok, but test suite always fails with the above result, I don’t why. Please help me to fix it.

This message implies that you have Apache Xerces-J 2.12.0 and earlier that implement the older versions of JAXP in the classpath. See

I guess you have some external jar files placed in the <katalonProjectDir>/Drivers or Plugins directory, and among these there is a jar which contains the older Xerces-J. You need to identify which jar is causing problem. But how to?

Create a new Test Case, copy and paste the following code in it:

import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

URL u = DocumentBuilderFactoryImpl.class.getResource("/" + DocumentBuilderFactoryImpl.class.getName().replaceAll("\\.", "/") + ".class");

System.out.println(u);

Run it. You will see in the Console tab something like this:

2021-06-14 09:00:29.689 DEBUG testcase.xerces                          - 2: out.println(u)
jar:file:/Applications/Katalon%20Studio.app/Contents/Eclipse/plugins/org.codehaus.groovy_2.4.20.v202009301404-e2006-RELEASE/lib/org.apache.xerces.impl_2.11.0.jar!/org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.class

This is my case on Mac osX + Katalon Studio 8.0.1. You would see some other jar:file://.... value.

Please try and show us what you find.

1 Like

that’s right, I got the same result

2021-06-14 08:42:26.010 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2021-06-14 08:42:26.012 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/Fix
2021-06-14 08:42:26.920 DEBUG testcase.Fix                             - 1: u = DocumentBuilderFactoryImpl.getResource("/" + getName().replaceAll("\.", "/") + ".class")
2021-06-14 08:42:26.929 DEBUG testcase.Fix                             - 2: out.println(u)
jar:file:/D:/Program%20Files/Katalon_Studio_Windows_64-8.0.1/plugins/org.codehaus.groovy_2.4.20.v202009301404-e2006-RELEASE/lib/org.apache.xerces.impl_2.11.0.jar!/org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.class
2021-06-14 08:42:26.941 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/Fix

Both of us, @whisstuan.nguyen and @kazurayam, have org.apache.xerces.impl_2.11.0.jar.

And according to the StackOverflow post ( https://stackoverflow.com/questions/53299280/java-and-xerces-cant-find-property-xmlconstants-access-external-dtd ), this version 2.11.0 has a potential to raise the Exception which @whisstuan.nguyen reported.

Then why @whisstuan.nguyen encountered the Exception and I do not?

I think that the exception is raised only when @whisstuan.nguyen’s Test Case script received a XML document from the web server and the XML document starts with a line of External Document Type Definition, something like:

<?xml version = "1.0" encoding = "UTF-8" standalone = "no" ?>
<!DOCTYPE address SYSTEM "address.dtd">
....

@whisstuan.nguyen

Could you please print the XML document which your test script received from the server, and see if it contains a line of External DTD or not?

@whisstuan.nguyen

As far as I know, External DTD is not widely used in the business world. It is a rare case. External DTD makes XML processing complicated and difficult. It is unfortunate if you, @whisstuan.nguyen, encountered XML with External DTD

Is the URL of yhe XML in question publicly accessicle on the Internet? if so pls share it to us. I ask this because i would need to reproduce your problem on my PC. Otherwise it is difficult to find a provable solution.

@kazurayam
Unfortunately, I cannot give you the URL, but I see the XML response didn’t contain External DTD

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    ....................

Another way, I asked my partner and run it at version 7.9, and it has worked well.
And one more thing I found that version 8.0.1 used Zulu platform instead of Java, so I think maybe this caused the trouble

@ThanhTo
@duyluong

@whisstuan.nguyen wrote:

He wrote Katalon Studio 8.0.x Zulu platform. Do you confirm it?

He wrote Zulu platform is causing the aforementioned problem. Do you recognise it? Any comment?

OK, that proves my guess was pointless.

I made a Test Case script to see what type of JRE Katalon uses.

def systemProperties = [
	"java.vendor",
	"java.vendor.url",
	"java.version",
	"java.vm.info",
	"java.vm.name",
	"java.vm.specification.name",
	"java.vm.specification.vendor",
	"java.vm.specification.version",
	"java.vm.vendor",
	"java.vm.version",
	"os.arch",
	"os.name",
	"os.version"]

StringBuilder sb = new StringBuilder()
for (prop in systemProperties) {
	sb.append("${prop}=${System.getProperty(prop)}\n")
}
print(sb.toString())

Katalon Stduio v8.0.1 showed

2021-06-15 15:38:51.756 DEBUG testcase.Zulu Platform                   - 4: print(sb.toString())
java.vendor=Azul Systems, Inc.
java.vendor.url=http://www.azulsystems.com/
java.version=1.8.0_275
java.vm.info=mixed mode
java.vm.name=OpenJDK 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=1.8
java.vm.vendor=Azul Systems, Inc.
java.vm.version=25.275-b01
os.arch=x86_64
os.name=Mac OS X
os.version=10.16

the 7.9.1 showed

java.vendor=Azul Systems, Inc.
java.vendor.url=http://www.azulsystems.com/
java.version=1.8.0_275
java.vm.info=mixed mode
java.vm.name=OpenJDK 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.specification.version=1.8
java.vm.vendor=Azul Systems, Inc.
java.vm.version=25.275-b01
os.arch=x86_64
os.name=Mac OS X
os.version=10.16

Well I found no difference between the two.

I am not sure what is implied by the Windows Security Alert that @whisstuan.nguyen reported.

@kazurayam
because I see the difference between the two versions here (attachment), and this is just my guess, I’m not sure
image

I am confused, too :grinning: so I think the best solution at this time for this issue that we should use KS 7.9.1

I agree.

@ThanhTo
@duyluong

Please check

This seems to be an known issue in v8.0.1

See also

I got it, thank you @kazurayam

Has this issue been resolved yet, I am having the same issue and am holding at version 7.9.1 at this time.

What is the ETA on this critical bug? How can we, the community, contribute to resolution? Please respond

@duyluong wrote that the “accessExternalDTD” problem will be fixed in the v8.1.0. v8.1.0 beta is available.

I don’t know. Ask Katalon team. → @duyluong

@clif.molina,

What is the ETA on this critical bug?

v8.1.0 was estimated to release on August 18.

How can we, the community, contribute to resolution?

You can find Katalon Studio keywords source code here. This repository is not really our source code repository but we will keep the source code in this repo and ours the same.
To contribute a solution, you can create a PR for a bug fix. We will review the PR and merge to our private official repository if the PR is necessary for us.