Running Nashorn under java.lang.instrument
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Mon Oct 13 23:01:17 UTC 2014
David,
There was a bug fixed recently (JDK-8058536 [1]), which blocked usage of
java.lang.invoke from java agents. Unfortunately, the fix is not part of
any release yet. Latest 8u40 & 9 early access builds should contain it.
Please, give them a try.
Best regards,
Vladimir Ivanov
[1] https://bugs.openjdk.java.net/browse/JDK-8058536
On 10/14/14, 1:37 AM, David P. Caldwell 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/
>
More information about the nashorn-dev
mailing list