Part of the issue is that I was incorrect that Nashorn would be loaded by the system class loader; it is actually loaded by the extensions class loader, so my code will indeed attempt to instrument Nashorn itself. I don't know whether that should work or not, but it's not what I was trying to do, so I'm going to continue debugging and will report back if and as I find useful things.
On Mon, Oct 13, 2014 at 5:37 PM, David P. Caldwell <[email protected]> wrote: > So if I run Nashorn under a Java agent, I can't start it. I haven't > yet dug into the error, but when I invoke: > > return new ScriptEngineManager().getEngineByName("nashorn") != null > > , which is my "is Nashorn installed" check, the following prints to > System.err: > > ScriptEngineManager providers.next(): > javax.script.ScriptEngineFactory: Provider > jdk.nashorn.api.scripting.NashornScriptEngineFactory could not be > instantiated > > Does anyone immediately know what would be wrong? > > My Transformer in the class does this: > > if (protectionDomain == null) return null; > > ... so it shouldn't be attempting to transform any Nashorn classes. > > On the other hand, if it's relevant, the ClassLoader that loaded the > class above that executes return new ScriptEngineManager() ... is not > loaded by the system class loader; it's loaded by an URLClassLoader > that sits on top of that (it does delegate to the system class > loader). Under normal circumstances, this wouldn't make a difference, > but just in case ... > > Anyone immediately have an idea what I might be dealing with here? > > -- David P. Caldwell > http://www.davidpcaldwell.com/
