graalvm / fastr-examples

Other
60 stars 15 forks source link

All polygot scripts run with bootpath classloader? #2

Open jhspaybar opened 6 years ago

jhspaybar commented 6 years ago

I'm trying to Java.extend(SomeClass, {}); with the javascript examples, and running into a TypeError TypeError: Could not determine a class loader with access to the JS engine and class com.thing.SomeClass. I've tried both executing the node binary directly with the javascript file, as well as starting in Java and using Context context = Context.newBuilder().allowHostAccess(true).engine(Engine.newBuilder().build()).build(); and context.eval("js", "...");. It seems that the underlying polyglot engine is still made during the bootpath classloader creation and so is unable to extend application classloader types. I made a question over on stack overflow as well https://stackoverflow.com/questions/48728080/graalvm-nashorn-cannot-extend-classes and it looks like I might be one of the first to hit this :) I was hoping someone in this project might have more guidance, or a way to get the javascript executing in the application classloader.