I have JON configured to call Rhino scripts when certain exceptional events are detected by the agent. The issue I'm having is that I require the ability to include a custom JAR file with external source code so that I can execute my desired action via the Rhino script. How do I add a custom JAR to the Rhino classpath?
I don't think that is something we currently allow.
I discussed this briefly with Mazz and one possibility we came up with is to create Server Plugin, deploy it into the server, and then have your script interact with that plugin. The server plugin can, I think, contain its own jars.
See here for more on server plugin development:
There is also a possibly relevant BZ here:
Thanks for the feedback. The alternative approach I decided to go with was have a Rhino script call a shell script, which invokes my Java code and performs my work. For example,
And in the shell script I can simply invoke Java (java -jar etc....). This seems to be doing the trick.
I do believe I tried this and used importPackage(...) to try and include my library in the Rhino script, but without success. If this does indeed work, it is definitley a cleaner solution. However, since what I currently have is working I'm going to leave it as is for now. Thanks for the suggestion.