[
https://issues.apache.org/jira/browse/NIFI-7173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pierre Villard reassigned NIFI-7173:
------------------------------------
Assignee: Pierre Villard
> NoClassDefFoundError: org/apache/nifi/metrics/jvm/JmxJvmMetrics
> ---------------------------------------------------------------
>
> Key: NIFI-7173
> URL: https://issues.apache.org/jira/browse/NIFI-7173
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.10.0, 1.11.0, 1.11.1, 1.11.2, 1.11.3
> Environment: centos
> Reporter: Gert Bracke
> Assignee: Pierre Villard
> Priority: Minor
>
> 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) {
> datalines += (makeMeasurementPoint(localhostname,pg.getName(),measure,
> returnMeasurementValue(pg,measure))?:[]);
> }
> 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")) { stopped++; }
> if (ps.getRunStatus().toString().equals("Running")) { running++; }
> if (ps.getRunStatus().toString().equals("Invalid")) { invalid++; }
> if (ps.getRunStatus().toString().equals("Disabled")) { 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 { log.error("ERROR: no controllerstatus from context"); } }
> else { log.error("ERROR: no access from context"); }}
> else { log.error("ERROR: no InfluxDB property specified: no destination for
> status reporting!");}
> def makeMeasurementPoint(String collector, String flowName, String
> measurement, Long value) {
> if (value!=null) {
> def line = StringBuilder.newInstance();
> line.append "hostName="+collector+",";
> line.append "flowName="+flowName.replaceAll(" ","_")+",";
> line.append "measurementName="+measurement+" ";
> line.append "value="+value.toString() ;
> return line.toString(); }
> return null;}
> def returnMeasurementValue(ProcessGroupStatus pgs, String measurementName) {
> Long result=null; if ((pgs!=null) && (measurementName!=null) &&
> (measurementName?.trim())) {
> switch(measurementName) {
> case "bytesRead": result=(pgs.getBytesRead()>0 ? pgs.getBytesRead() :
> pgs.getBytesReceived());break;
> case "bytesWritten": result=(pgs.getBytesWritten()>0 ? pgs.getBytesWritten()
> : pgs.getBytesSent());break;
> case "queuedCount": result=pgs.getQueuedCount();break;
> case "flowfilesReceived": result=pgs.getFlowFilesReceived();break;
> case "flowfilesTransferred": result=pgs.getFlowFilesTransferred();break; } }
> return result;}
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)