Today I am no longer getting this error for the same code.
As per the discussion on the same error in IIQ, it says it is because
“The error you’re encountering is due to changes in Java module access controls introduced in Java 9 and later versions. Java 17 enforces stricter encapsulation, and HttpsURLConnectionImpl is part of a package that is not exported to unnamed modules, which includes BeanShell.”
Thank you all who replied to this discussion.
Regards
Mathew