-
Type:
Bug
-
Status: Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.10.0, 1.11.0, 1.11.1, 1.11.2, 1.11.3
-
Fix Version/s: 1.12.0
-
Component/s: Extensions
-
Labels:None
-
Environment:centos
ScriptedReportingTask gives a NoClassDefFoundError: org/apache/nifi/metrics/jvm/JmxJvmMetrics
In version 1.9.2 this is working fine.
both java 8 and java 11 give same result.
the full error is
2020-02-19 16:00:26,601 ERROR [Timer-Driven Process Thread-1] o.a.n.c.s.StandardProcessScheduler Failed to invoke the On-Scheduled Lifecycle methods of [ScriptedReportingTask[id=5c7abfa0-0170-1000-d7ca-45dd4b4e23ed], java.lang.reflect.InvocationTargetException, 30 sec] due to {}; administratively yielding this ReportingTask and will attempt to schedule it again after {}
java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:142)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:130)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:75)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:52)
at org.apache.nifi.controller.scheduling.StandardProcessScheduler$2.run(StandardProcessScheduler.java:222)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: org/apache/nifi/metrics/jvm/JmxJvmMetrics
at org.apache.nifi.reporting.script.ScriptedReportingTask.setup(ScriptedReportingTask.java:146)
... 16 common frames omitted
2020-02-19 16:00:30,590 INFO [pool-12-thread-1] o.a.n.c.r.WriteAheadFlowFileRepository Initiating checkpoint of FlowFile Repository
2020-02-19 16:00:30,591 INFO [pool-12-thread-1] o.a.n.c.r.WriteAheadFlowFileRepository Successfully checkpointed FlowFile Repository with
Im not sure but i think the nifi-metrics jar is missing in the 1.11 version
Its a groovy script, I removed the writing to the influx db
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.reporting.EventAccess;
import org.apache.nifi.controller.status.ProcessGroupStatus;
import org.apache.nifi.controller.status.ProcessorStatus;
final EventAccess access = context.getEventAccess();measurementsArray = ["bytesRead", "bytesWritten", "queuedCount", "flowfilesReceived", "flowfilesTransferred"];
String localhostname = java.net.InetAddress.getLocalHost().getHostName();
String influxUrl = InfluxDB.value;
List<String> datalines = [];
// if no database specified then dont bother to collect data
if ((influxUrl!=null)&&(!influxUrl.equals(""))) {
if (access!=null) {
final ProcessGroupStatus procGroupStatus = access.getControllerStatus();
if (procGroupStatus!=null) {
for (ProcessGroupStatus pg : procGroupStatus.getProcessGroupStatus()) {
for (String measure : measurementsArray)
Long running = 0 ; Long stopped = 0 ; Long invalid = 0 ; Long disabled = 0 ;
for (ProcessorStatus ps : pg.getProcessorStatus()) {
if (ps!=null) {
if (ps.getRunStatus().toString().equals("Stopped"))
if (ps.getRunStatus().toString().equals("Running"))
{ running++; }
if (ps.getRunStatus().toString().equals("Invalid"))
if (ps.getRunStatus().toString().equals("Disabled"))
//log.info("runstatus: " + ps.getRunStatus().toString()); } }
datalines += makeMeasurementPoint(localhostname,pg.getName(),"processorsRunning", running);
datalines += makeMeasurementPoint(localhostname,pg.getName(),"processorsStopped", stopped);
datalines += makeMeasurementPoint(localhostname,pg.getName(),"processorsInvalid", invalid);
datalines += makeMeasurementPoint(localhostname,pg.getName(),"processorsDisabled", disabled);
} } else
}
else { log.error("ERROR: no access from context"); }}
else
def makeMeasurementPoint(String collector, String flowName, String measurement, Long value) {
if (value!=null)
return null;}
def returnMeasurementValue(ProcessGroupStatus pgs, String measurementName) {
Long result=null; if ((pgs!=null) && (measurementName!=null) && (measurementName?.trim())) {
switch(measurementName)
}
return result;}
- is caused by
-
NIFI-5373 Create Metrics API and default implementation
-
- Resolved
-
- links to