Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
babarr38
Contributor
Contributor

Error on tWriteJSONFields Exception in thread "main" java.lang.IllegalAccessError: superclass access check failed: class nu.xom.JDK15XML1_0Parser cannot access class com.sun.org.apache.xerces.internal.parsers.SAXParser (in module java.xml)

Hello,

I am trying to make a script : from the data of a table, generates information in JSON format intended to enter POST of a Rest API.

For the moment, I try to generate the json format of the data.

For this, I followed the following process : https://help.talend.com/r/atTvdntoupqchAynyb03~Q/HEM67TFAw5wcWyeutC5UMg

0695b00000Rh4VlAAJ.png

with

0695b00000Rh4W0AAJ.png

0695b00000Rh4WKAAZ.png

and

0695b00000Rh4WZAAZ.png

When I execute a job, I have the error :

Exception in thread "main" java.lang.IllegalAccessError: superclass access check failed: class nu.xom.JDK15XML1_0Parser (in unnamed module @0x562e5de8) cannot access class com.sun.org.apache.xerces.internal.parsers.SAXParser (in module java.xml) because module java.xml does not export com.sun.org.apache.xerces.internal.parsers to unnamed module @0x562e5de8

at java.base/java.lang.ClassLoader.defineClass1(Native Method)

at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)

at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)

at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)

at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)

at java.base/java.lang.Class.forName0(Native Method)

at java.base/java.lang.Class.forName(Class.java:375)

at nu.xom.Builder.findParser(Unknown Source)

at nu.xom.Builder.<init>(Unknown Source)

at nu.xom.Builder.<init>(Unknown Source)

at net.sf.json.xml.XMLSerializer.read(XMLSerializer.java:374)

at pegase_talend_api_base_locale.job_api_ref_maj_type_objet_formation_0_1.job_api_ref_maj_type_objet_formation.tWriteJSONField_1_InProcess(job_api_ref_maj_type_objet_formation.java:3223)

at pegase_talend_api_base_locale.job_api_ref_maj_type_objet_formation_0_1.job_api_ref_maj_type_objet_formation$1ThreadXMLField_tWriteJSONField_1_Out.run(job_api_ref_maj_type_objet_formation.java:1964)

The librairie for use this composant are installed

0695b00000Rh4YVAAZ.png

I work with Java jdk 17 and talend studio 8.0.1

Do you have an idea why this error is genered ?

Thanks

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

Java 17 is not a compatible Java version, please use Java 8 or 11, for details, please refer to the installation documentation page.

 

Regards

Shong

View solution in original post

8 Replies
Anonymous
Not applicable

Hi

Java 17 is not a compatible Java version, please use Java 8 or 11, for details, please refer to the installation documentation page.

 

Regards

Shong

babarr38
Contributor
Contributor
Author

Hello,

Thanks a lot of.

I installed java version 11 and it works

Have a good day,

GPHemsley-RELX
Contributor
Contributor

Note that it is still possible to get this error on Java 11 if running with `--illegal-access=deny`.

 

A newer version of the xom library (1.3.7) is available that reportedly does not have this problem and is fully backwards compatible. (As shown in the screenshot, Talend has bundled xom 1.2.7.)

 

https://github.com/elharo/xom/releases/tag/v1.3.7

 

As a workaround, the following override flags can be used at runtime:

--add-exports='java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED'

--add-exports='java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED'

 

Lord-Vader
Contributor III
Contributor III

UPDATE To this post. I encountered this error too today.

My machine: JDK 19, talend version 8.0.1, xom-1.2.7(default)

 

For search purposes ERROR: Exception in thread "main" java.lang.IllegalAccessError: superclass access check failed: class nu.xom.JDK15XML1_0Parser (in unnamed module @0x57baeedf) cannot access class in talend com.sun.org.apache.xerces.internal.parsers.SAXParser (in module java.xml) because module java.xml does not export com.sun.org.apache.xerces.internal.parsers to unnamed module @0x57baeedf.

I downloaded the latest XOM-jar(currently 1.3.9) file : https://mvnrepository.com/artifact/xom/xom/1.3.9 and it works fine.

 

Changing the module: https://help.talend.com/r/en-US/8.0/studio-user-guide/overriding-external-modules-by-customizing-mvn...

Hope this helps someone.

 

Vader Out 💪.

babarr38
Contributor
Contributor
Author

Hello,

 

I propose to you this idea because we have this probleme again when a new person works with this composant.

We make a little script .bat to force Talend to work with java 11

 

It is a follow little script

 

cd "write directory of Talend soft ex C:\...\Talend\TOS_DI-8.0.1\studio"

TOS_DI-win-x86_64.exe -vm "write directorie of java 11 ex : "C:\...\jdk-11\bin"

 

This is with this script that we run talend

 

Have a good day

august1
Contributor
Contributor

Hello,

 

This is now 2024 and Java 17 is officially supported. However I still got the same error.

 

Is the solution proposed by Lord-Vador (changing the MVN module with the latest XOM-jar) still what I should do ?

 

Have a nice day,

Xiaodi_Shi
Support
Support

Hello,

We have added support for JDK 17 from R2023-10 onwards.

If you have installed the 8.0 R2022-12 Talend Studio monthly update or a later one provided by Talend, you can configure whether to allow Jobs to access internal Java fields and methods in Talend Studio.

Here is our online documentation about:

https://help.talend.com/r/en-US/8.0/studio-user-guide/setting-compiler-compliance-level

Note: The java version used to execute the job from Studio with "Target exec" = localhost depends on the java interpreter set in preferences  (And do NOT depends on the Java version used by the Studio itself)
So even if the Studio is using Java 17 for itself , you'll need to check this option if you want to run jobs with Java 17

Best regards

Sabrina

 

august1
Contributor
Contributor

Thanks a lot, that was the solution, enabling the Java 17 compatibility was the key !

 

(I am running the version R2024-01 )