Avatar ·

Error "Access restriction on class due to restriction on required library rt.jar" in Eclipse when working with WSDL

Hello everyone! I'm a beginner Java developer writing a client for a web service based on WSDL. I'm using Eclipse (latest version) and generated stub classes via wsdl2java from Axis2. Everything compiled fine, but when I try to use one of the classes (e.g., `javax.xml.soap.SOAPConnection` or `com.sun.xml.internal.messaging.saaj.soap.MessageImpl`), Eclipse throws an error: ``` Access restriction on class 'javax.xml.soap.SOAPConnection' due to restriction on required library rt.jar ``` I checked: the project uses JRE System Library [JavaSE-1.8] (jre1.8.0_281). There's nothing extra in the lib folder. Online advice suggests unchecking "Access Rules" in Eclipse settings — but that seems wrong, as it could break other projects. Here's an example of the code that causes