<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi,<div class=""><br class=""></div><div class="">Iām running into a problem while dynamically loading a Postgres JDBC driver in GraalVM 20.0.0:</div><div class=""><br class=""></div><div class="">No suitable driver found for jdbc:postgresql://ā¦</div><div class=""><br class=""></div><div class="">The jar file of the driver is loaded and wrapped in its own class loader which is only accessible from that script:</div><div class=""><br class=""></div><div class="">ScriptEngineManager manager = new ScriptEngineManager();<br class="">Thread.currentThread().setContextClassLoader(createClassLoader()); // <ā here<br class="">ScriptEngine engine = null;<br class="">if (ISGRAAL)<br class=""> engine = GraalSetup.engine();<br class="">else<br class=""> engine = manager.getEngineByName((String) entity.getProperty("script-language").getValue());<br class="">if (engine == null)<br class=""> throw new Exception("Engine for script-language '" + entity.getProperty("script-language").getValue() + "' not found!");<br class="">ScriptContext newContext = new SimpleScriptContext();<br class="">streamContext.engineScope = engine.createBindings();<br class="">streamContext.engineScope.put("stream", streamContext.stream);<br class="">streamContext.engineScope.put("parameters", new Parameters((EntityList) entity.getEntity("parameters")));<br class="">streamContext.engineScope.put("time", new TimeSupport());<br class="">streamContext.engineScope.put("os", new OsSupport());<br class="">streamContext.engineScope.put("repository", repositorySupport);<br class="">streamContext.engineScope.put("transform", new ContentTransformer());<br class="">streamContext.engineScope.put("typeconvert", new TypeConverter());<br class="">newContext.setBindings(streamContext.engineScope, ScriptContext.ENGINE_SCOPE);<br class=""><br class="">engine.eval(loadScript((String) entity.getProperty("script-file").getValue()), newContext);<br class="">Thread.currentThread().setContextClassLoader(null); // <ā set to null according to Nashorn docs<br class=""><br class=""></div><div class="">This works fine in Nashorn.</div><div class=""><br class=""></div><div class="">Any hints?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Andreas</div><div class=""><br class=""><div class="">-- <br class="">Andreas Mueller<br class="">IIT Software GmbH<br class=""><a href="https://urldefense.com/v3/__http://www.swiftmq.com__;!!GqivPVa7Brio!Ms2XkShgysH4XgRTk7KWA2cYKkEkn-BGaOdnj-hIFeZlRXR07RK2UNIL8soXerc-iB0sFw$" class="">http://www.swiftmq.com</a><br class=""><br class=""><span><img apple-inline="yes" id="E840002C-3482-48BA-9686-2F2AD494FEBF" src="cid:A0309C4C-D818-48E8-A9CE-B43C74051926@multi.box" class=""></span></div><br class=""></div></body></html>