Hi Reece,
If you install your Java code as JAR file in the repository [1], the code will be loaded and unloaded every time when your query is executed. If you get an error message…
java.lang.reflect.InaccessibleObjectException: Unable to make field private final jdk.internal.loader.URLClassPath java.net.URLClassLoader.ucp accessible: module java.base does not "opens java.net" to unnamed module @79e2c065
…unloading fails [2], as you’re probably using a more recent version of the JDK, which restricts reflective access to internal variables. You can get around this by adding Java flags at startup time:
--add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
Maybe there are better solutions to unload JAR files today. Suggestions are welcome!
Hope this helps, Christian
[1] https://docs.basex.org/wiki/Repository#Java [2] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/ba...
On Tue, Apr 20, 2021 at 6:44 PM Reece Dunn msclrhd@googlemail.com wrote:
Hi all,
I'm working on a Java class that I'm importing into an XQuery, so I can do additional processing on the data that isn't easily expressible in XQuery (or XSLT). In order to get BaseX to pick up a modified version of the jar file I'm building, I'm restarting the BaseX http server.
This makes it slower to turn around testing the changes. Is there a better way of doing this?
Kind regards, Reece