Thanks Sundar. I am not having any issues currently, all seems to be working great. We just added the ClassFilter so I had to change the constructor from:
engine = new NashornScriptEngineFactory().getScriptEngine(new String[]{"-ccs=1000", "-ot=true", "-pcc=true"}); TO engine = new NashornScriptEngineFactory().getScriptEngine(new String[]{"-ccs=1000", "-ot=true", "-pcc=true"}, ClassLoader.getSystemClassLoader(), nashornClassFilter); I saw notes on the ClassFilter in the docs, but not an example with the ClassLoader, so I just wanted to be sure I was not going to cause myself any issues. Tony On Mon, Mar 21, 2016 at 10:12 AM, Sundararajan Athijegannathan < sundararajan.athijegannat...@oracle.com> wrote: > By default Nashorn uses the thread context loader - which is usually > ClassLoader.getSystemClassLoader() [ which is the launcher loader ]. > > So, your API call looks fine. What is the specific issue, if any, > you've in mind? > > Thanks > -Sundar > > On 3/20/2016 10:45 PM, Tony Zakula wrote: > > Hey All, > > > > I am using a ClassShutter to limit the Java classes scripts can use, but > I > > am wondering how to use the proper ClassLoader in the constructor. The > > following seems to work fine, but is there a better way? Our > > initialization code looks like the following: > > > > // There is a bug on startup sometimes with persistent code cache > > where you get a null pointer > > // https://bugs.openjdk.java.net/browse/JDK-8134304 - We can > > swallow it because things run normally > > ScriptEngine engine = null; > > > > // Custom ClassFilter > > NashornClassFilter nashornClassFilter = new NashornClassFilter(); > > > > try { > > engine = new NashornScriptEngineFactory().getScriptEngine(new > > String[]{"-ccs=1000", "-ot=true", "-pcc=true"}, > > ClassLoader.getSystemClassLoader(), nashornClassFilter); > > } > > catch (Exception e) {} > > > > Thanks, > > > > Tony > >