java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException error while running test suites

I am using Katalon Studio 8.3.5 on Windows 10.
I am facing a common issue in all test projects I create, including sample projects, when I run any test suites, towards it’s end during report generation, in both Katalon Studio and runtime engine:


I was able to solve it by adding the jaxb-api jar to the project, but it seems to be coming by default in all projects.

@duyluong @nam.nguyen

1 Like

@aasheesh.jha

Please share the .classpath under the root project

1 Like

Attaching the .classpath file in the project.
.classpath (42.8 KB)

@duyluong can you help close out this issue? Thank you, Sara

Hi, is there any update on this item? Thanks.

@aasheesh.jha

Just remove katalon_generated_jaxb-core-3.0.2.jar and katalon_generated_jaxb-impl-3.0.2.jar in Drivers folder then reopen project again

1 Like

I am getting the same error on removing the two mentioned jars.
The only time report generation after test suite is successfully happening(reports published in html and csv formats) is when I have added the external jar jaxb-api-.jar
To confirm the issue, I created a new simple project with just one simple test case only printing java version and no other changes. I noticed the same issue in this project also, so it appears to be a Katalon bug as a new project has this issue by default. This project does not have these jars by default, I am attaching its zip here.
SampleReportTest.zip (31.0 KB)

Another issue I found is, with default build.gradle in a new project(id “com.katalon.gradle-plugin” version “0.0.7”), if I run the gradle katalonCopyDependencies, it fails with the following message:
image
But if I update plugin version to 0.1.1, it builds successfully, so there appears to be an issue with the default build.gradle.

I have an update to this issue. The report generation does not happen even with the jaxb-api-.jar added, whenever I instantiate a mockserver in my test case. I am getting this error message:


I have taken a very simple response action example from a mockserver link Creating Expectations. , whose zip I have attached here, after removing the mockserver jars added from gradle dependency to bring it within size limit. I am using the implementation ‘org.mock-server:mockserver-netty:5.13.2’ dependency in build.gradle.
TestProject.zip (790.8 KB)

Which version of Java are you using in Katalon Studio?
I suppose you intentionally upgraded to Java9 or higher, didn’t you?

If you are using Java9 or higher, you would certainly see java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException. Why? See the following StackOverflow discussion:

Katalon Studio officially uses Java8, which bundles jaxb libraries. On the other hand, you have option to upgrade to Java9 or higher for Katalon Studio & KRE to run on. Then all issues caused by upgrading Java version should be taken care of by you.

Then you should be happy with v0.1.1, aren’t you?

Do you mean, the “default build.gradle” file shoule be changed to use “0.1.1” instead of “0.0.7”?
I agree with you.

However, I personally do not expect Katalon Team to work on Gradle much. As the following document indicates, Katalon uses Gradle as a Proof-of-concept. A Poc is not a productional feature. Users should not claim much about it.

Thanks for your reply, yes, I am using Java 17. I went through the link and implemented the Proper long-term solution: (JDK 9 and beyond). So I included implementation “jakarta.xml.bind:jakarta.xml.bind-api:2.3.2” and implementation “org.glassfish.jaxb:jaxb-runtime:2.3.2”, however I continued to get java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
But after adding implementation group: ‘javax.xml.bind’, name: ‘jaxb-api’, version: ‘2.3.1’, report generation starts happenning, untill I use mockserver in my test case.
As soon as I instantiate mockserver in my tests, even with all dependencies in build.gradle
build.gradle (1.0 KB)
.classpath (37.4 KB)
, I start getting this issue:

2022-07-22 12:17:51.811 WARN com.kms.katalon.core.util.KeywordUtil - com.fasterxml.aalto.WFCException: Unexpected character ‘D’ (code 68) in xml document (expected either ‘-’ for COMMENT or ‘[CDATA[’ for CDATA section)
at [row,col {unknown-source}]: [415,4]
at com.fasterxml.aalto.in.XmlScanner.reportInputProblem(XmlScanner.java:1333)
at com.fasterxml.aalto.in.XmlScanner.throwUnexpectedChar(XmlScanner.java:1498)
at com.fasterxml.aalto.in.XmlScanner.reportTreeUnexpChar(XmlScanner.java:1375)
at com.fasterxml.aalto.in.ReaderScanner.handleCommentOrCdataStart(ReaderScanner.java:481)
at com.fasterxml.aalto.in.ReaderScanner.nextFromTree(ReaderScanner.java:289)
at com.fasterxml.aalto.stax.StreamReaderImpl.next(StreamReaderImpl.java:760)
at com.kms.katalon.core.logging.TestSuiteXMLLogParser.processFile(TestSuiteXMLLogParser.java:88)
at com.kms.katalon.core.logging.TestSuiteXMLLogParser.readTestSuiteLogFromXMLFiles(TestSuiteXMLLogParser.java:65)
at com.kms.katalon.core.reporting.basic.reporting.ReportWriterUtil.generate(ReportWriterUtil.java:381)
at com.kms.katalon.core.reporting.basic.reporting.ReportWriterUtil.generate(ReportWriterUtil.java:386)
at com.kms.katalon.core.reporting.basic.reporting.ReportWriterUtil$generate.call(Unknown Source)
at KatalonReportListener.exportKatalonReports(KatalonReportListener.groovy:41)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)2022-07-22 12:17:51.852 INFO c.k.katalon.core.main.TestSuiteExecutor - --------------------

    at KatalonReportListener.invokeMethod(KatalonReportListener.groovy)

2022-07-22 12:17:51.852 INFO c.k.katalon.core.main.TestSuiteExecutor - END Test Suites/Suite1 at com.kms.katalon.core.context.internal.TestHooker.invokeMethod(TestHooker.java:111)

    at com.kms.katalon.core.context.internal.TestHooker.lambda$3(TestHooker.java:95)
    at com.kms.katalon.core.context.internal.TestHooker.invokeContextMethods(TestHooker.java:94)2022-07-22 12:17:51.852 INFO  c.k.katalon.core.main.TestSuiteExecutor  - ====================

    at com.kms.katalon.core.context.internal.TestListenerCollector.lambda$3(TestListenerCollector.java:88)
    at com.kms.katalon.core.context.internal.TestListenerCollector.handleListenerEvent(TestListenerCollector.java:85)
    at com.kms.katalon.core.context.internal.ExecutionEventManager.publicEvent(ExecutionEventManager.java:36)
    at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:110)
    at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:185)
    at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
    at TempTestSuite1658472461558.run(TempTestSuite1658472461558.groovy:36)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Launcher status after execution process completed: Running

Fri Jul 22 12:17:55 IST 2022
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[415,10]
Message: Scanner State 24 not Recognized
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:604)
at com.kms.katalon.core.logging.TestSuiteXMLLogParser.processFile(TestSuiteXMLLogParser.java:88)
at com.kms.katalon.core.logging.TestSuiteXMLLogParser.readTestSuiteLogFromXMLFiles(TestSuiteXMLLogParser.java:65)
at com.kms.katalon.core.reporting.ReportUtil.generate(ReportUtil.java:460)
at com.kms.katalon.core.reporting.ReportUtil.generate(ReportUtil.java:470)
at com.kms.katalon.execution.launcher.ReportableLauncher.prepareReport(ReportableLauncher.java:375)
at com.kms.katalon.execution.launcher.ReportableLauncher.preExecutionComplete(ReportableLauncher.java:156)
at com.kms.katalon.execution.launcher.ProcessLauncher.onWatchdogComplete(ProcessLauncher.java:194)
at com.kms.katalon.execution.launcher.LaunchWatchdog.notifyProcessTerminated(LaunchWatchdog.java:136)
at com.kms.katalon.execution.launcher.LaunchWatchdog.run(LaunchWatchdog.java:66)
at java.lang.Thread.run(Thread.java:748)

System is unable to generate report. Reason: null

Fri Jul 22 12:17:55 IST 2022
java.lang.NullPointerException
at com.kms.katalon.execution.launcher.ReportableLauncher.preExecutionComplete(ReportableLauncher.java:158)
at com.kms.katalon.execution.launcher.ProcessLauncher.onWatchdogComplete(ProcessLauncher.java:194)
at com.kms.katalon.execution.launcher.LaunchWatchdog.notifyProcessTerminated(LaunchWatchdog.java:136)
at com.kms.katalon.execution.launcher.LaunchWatchdog.run(LaunchWatchdog.java:66)
at java.lang.Thread.run(Thread.java:748)