NullPointerException while running SimpleCopy example

Hi,

I am referencing this article http://wiki.cloveretl.com/doku.php?id=embedding_clover.
I am getting the below error -


[size=85]DEBUG [WatchDog] - Graph properties: {}
DEBUG [WatchDog] - Graph runtime context: {verboseMode=false, batchMode=true, runtimeClassPath=[], additionProperties={}, skipCheckConfig=false, trackingInterval=5000, synchronizedRun=false, compileClassPath=[], waitForJMXClient=false, password=null, contextURL=null, debugDirectory=C:\DOCUME~1\NBDQYXC\LOCALS~1\temp\, transactionMode=false, useJMX=true, debugMode=true}
ERROR [WatchDog] - Fatal error watchdog execution
java.lang.NullPointerException
	at org.jetel.graph.runtime.TrackingLogger.<init>(TrackingLogger.java:69)
	at org.jetel.graph.runtime.TrackingLogger.track(TrackingLogger.java:63)
	at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:193)
	at org.jetel.graph.runtime.WatchDog.call(WatchDog.java:64)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)[/size]

I have tried running the example using the graphSimpleCopy.grf and I did notice that there is an extra step that is executed : register MBean with name:org.jetel.graph.runtime:type=CLOVERJMX_1204550490058_0
which does not occur during programmatic graph instatiation.

Can someone assist ?

My code is below


[size=85]// start code
	public static void main(String[] args) throws GraphConfigurationException, ComponentNotReadyException, InterruptedException, ExecutionException {
		// TODO Auto-generated method stub
		
		
		String pluginsRootDirectory = "C:\\Working\\cloverETL.rel-3-2-1\\cloverETL\\plugins";
		String configFileName = "C:\\Working\\eclipse\\WorkflowLoader\\defaultProperties";
		String logHost = "localhost:4446";
		String inputFileName = "C:\\Working\\eclipse\\WorkflowLoaderSandbox\\InputFile.txt";
		String outputFileName = "C:\\Working\\eclipse\\WorkflowLoaderSandbox\\OutputFile.txt";

		// engine initialization - should be called only once
		EngineInitializer.initEngine(pluginsRootDirectory, configFileName, logHost);
		
		// runtime customization
		GraphRuntimeContext runtimeContext = new GraphRuntimeContext();
				
		// create new instance of transformation graph class
		TransformationGraph graph  = new TransformationGraph();
		
		// create graph phase
		Phase phase = new Phase(1);
		
		// create simple metadata
		DataRecordMetadata metadata = new DataRecordMetadata("RecordMetadata0", DataRecordMetadata.DELIMITED_RECORD);
		metadata.addField(new DataFieldMetadata("FieldMetadata0", "\n"));
		
		// create edges
		Edge inEdge = new Edge("InEdge", metadata);
		Edge outEdge = new Edge("OutEdge", metadata);
		Edge middleEdge = new Edge("OutEdge0",metadata);
		
		// create nodes
		Node nodeOne=new SimpleCopy("SimpleCopy1");
		Node nodeTwo=new SimpleCopy("SimpleCopy2");		
		Node nodeParser=new DataReader("DataReader1", inputFileName);		
		Node nodeWriter=new DataWriter("DataWriter1", outputFileName, "UTF-8", true);
		
		// add phase to graph; graph has to have at least one phase
		graph.addPhase(phase);
				  
		// add nodes to phase - all nodes in one phase are executed concurrently
		// phases are executed sequentially - in order defined by their number 
		phase.addNode(nodeOne);
		phase.addNode(nodeTwo);
		phase.addNode(nodeParser);
		phase.addNode(nodeWriter);
					
		// assign ports/nodex (input & output) 
		// this links together components - creates data flows
		nodeParser.addOutputPort(0, inEdge);
		nodeOne.addInputPort(0, inEdge);
		nodeOne.addOutputPort(0, middleEdge);
		nodeTwo.addInputPort(0, middleEdge);
		nodeTwo.addOutputPort(0, outEdge);
		nodeWriter.addInputPort(0, outEdge);
				  
		// add Edges & Nodes to graph
		graph.addEdge(inEdge);
		graph.addEdge(outEdge);
		graph.addEdge(middleEdge);
		
		// engine initialization
		EngineInitializer.initGraph(graph, runtimeContext);

		// graph running
		IThreadManager threadManager = new SimpleThreadManager();
		WatchDog watchDog = new WatchDog(graph, runtimeContext);
		Future<Result> futureResult = threadManager.executeWatchDog(watchDog);
		 
		//wait for end of graph
		Result result = futureResult.get();
		
		 if (result != Result.FINISHED_OK) {
			    System.out.println("Something was wrong.");
			    System.out.println(watchDog.getErrorMessage());
			    watchDog.getCauseException().printStackTrace();
			  } else {
			    System.out.println("Everthing was OK.");
			  }

	}

// End Code
[/size]

Hi jasonq323,

try to add initialization of watchdog by:


watchDog.init();

…right after WatchDog construction.

Works, thanks.

…or you can take a look on our updated Wiki: http://wiki.cloveretl.com/doku.php?id=embedding_clover

that was the one I actually followed but I missed out the difference between
runGraph.executeGraph
and
threadManager.initWatchDog(watchDog);

The first one will initialize the WatchDog.

I breakpointed through the source yesterday in the runGraph class to find the initWatchDog command.

Thanks for the help.