nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Thomsen <>
Subject Mixing ScriptEngine w/ controller services
Date Fri, 02 Nov 2018 12:38:50 GMT
I have a working relationship between a controller service and a processor,
but the processor uses a user-supplied Groovy script to massage some data.
The ScriptEngine is used to make a CompiledScript. I then have a pattern
that looks like this:

    public void onTrigger(ProcessContext context, ProcessSession session)
throws ProcessException {
        FlowFile input = session.get();
        if (input == null) {

        try (InputStream is = {
            RecordReader reader = readerFactory.createRecordReader(input,
is, getLogger());

            Bindings bindings = engine.createBindings();
            bindings.put("READER", reader);
            bindings.put("SOME_SERVICE", someService);



            session.transfer(input, REL_SUCCESS);
        } catch (Exception ex) {
            getLogger().error("Could not build segments.", ex);
            session.transfer(input, REL_FAILURE);

When I run the processor, I get a ScriptException whose ultimate cause is:

Caused by: java.lang.ClassNotFoundException: com.test.DAO
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(

Is there any way I can configure the classloader for the processor to be
able to work with the one used for the controller service so the script has
the ability to access the entire classpath from the controller service nar?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message