Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-7676

Nifi Processor dynamicallyModifiesClasspath doesn't work

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.11.4
    • Fix Version/s: None
    • Component/s: Configuration
    • Labels:
      None

      Description

      I am trying to pass custom jar to add in the class path for my Custom Processor.

      I have used below PropertyDescriptor 

      static final PropertyDescriptor ADDITIONAL_CLASSPATH_RESOURCES = new PropertyDescriptor.Builder()
              .name("Additional Classpath Resources")
              .displayName("Additional Classpath")
              .description("A comma-separated list of paths to files and/or directories that will be added to the classpath and used for loading native libraries. " +
                      "When specifying a directory, all files with in the directory will be added to the classpath, but further sub-directories will not be included.")
              .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
              .dynamicallyModifiesClasspath(true)
              .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
              .build();
      

      Also in onTrigger trying to read get the Class like this.

      Class<?> cls = Thread.currentThread().getContextClassLoader().loadClass("CustomerProto");
      Method m = cls.getDeclaredMethod("getDefaultInstance");

      I am getting ClassNotFoundException.

       

      I tried referring the existing Nifi JoltTransformRecord Processor. 

      https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-jolt-record-bundle/nifi-jolt-record-processors/src/main/java/org/apache/nifi/processors/jolt/record/JoltTransformRecord.java#L156

      Tried checking the test cases for this processor

      I found that there was no positive test case for dynamicallyModifiesClasspath.

      All the test cases are ignoring the custom class. 

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vijendra07kulhade Vijendra Kulhade
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: