VSI Match Script error in DevTest 10.8.x
search cancel

VSI Match Script error in DevTest 10.8.x

book

Article ID: 409369

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

Upgrading from 10.7.2 to 10.8.4 seeing errors in VS-->Transaction-->Match Script and causing the transaction to not match and VS returning the invalid response. Below error is seen in the log.
---------------------------
javax.script.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``// Right-click to insert a sample match script    testExec.log("Hello this is Be . . . '' : Error in method invocation: Cannot access method setRequestMethod( java.lang.String ) in 'class sun.net.www.protocol.https.HttpsURLConnectionImpl' :java.lang.IllegalAccessException: class bsh.Reflect cannot access class sun.net.www.protocol.https.HttpsURLConnectionImpl (in module java.base) because module java.base does not export sun.net.www.protocol.https to unnamed module @6a03bcb1 : at Line: 65 : in file: inline evaluation of: ``// Right-click to insert a sample match script    testExec.log("Hello this is Be . . . '' : conn .setRequestMethod ( "GET" ) 

 in inline evaluation of: ``// Right-click to insert a sample match script    testExec.log("Hello this is Be . . . '' at line number 65

at bsh.BshScriptEngine.evalSource(BshScriptEngine.java:102) ~[bsh-2.1.0.jar:2.1.0 2020-12-22 06:23:45]

at bsh.BshScriptEngine.eval(BshScriptEngine.java:61) ~[bsh-2.1.0.jar:2.1.0 2020-12-22 06:23:45]
-------------------------------

Environment

Service Virtualization 10.8.x

Cause

The error encountered 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.

Resolution

Adding the below property to Workstation.vmoptions (Validating in ITR) and VirtualServiceEnvironmentService.vmoptions (Validating in VSE) and restarting the components should resolve the issue.

--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED