# Fatal error during graph initialization

**URL:** <https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59>\
**Category:** CloverDX Platform\
**Created:** [July 16, 2007, 12:00am UTC](https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59 "2007-07-16T00:00:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 12:00am UTC](https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59/1 "2007-07-16T00:00:00Z")

</div>

hello sir  
i have implemented SPLIT\_RECORD component which read one record and write two to two differne toutput port.

but when i use SPLIT\_RECORD in my graph its give fatal error in graph initialization.

here is my graph

\<?xml version="1.0" encoding="UTF-8"?\> 0 and sv.current\_version and sv.sales\_representativ=em.id and em.person\_master\_id=pm.id and sd.sv\_id=sv.id"/\> import org.jetel.component.DataRecordTransform; import org.jetel.data.\*; import java.util.Date; 

public class reformatOrders extends DataRecordTransform{

int counter=1;  
int field=0;

public boolean transform(DataRecord source, DataRecord target){  
try{

Date saleDate=GetVal.getDate(source[0],“date”);  
SetVal.setInt(target[0],“time\_id”,counter);  
SetVal.setInt(target[0],“day”,saleDate.getDate());  
SetVal.setInt(target[0],“month”,saleDate.getMonth()+1);  
switch(saleDate.getMonth()+1)  
{  
case 1:  
SetVal.setString(target[0],“month\_name”,“January”);  
SetVal.setString(target[0],“quarter”,“Q1”);  
break;  
case 2:  
SetVal.setString(target[0],“month\_name”,“Fabruary”);  
SetVal.setString(target[0],“quarter”,“Q1”);  
break;  
case 3:  
SetVal.setString(target[0],“month\_name”,“March”);  
SetVal.setString(target[0],“quarter”,“Q1”);  
break;  
case 4:  
SetVal.setString(target[0],“month\_name”,“April”);  
SetVal.setString(target[0],“quarter”,“Q2”);  
break;  
case 5:  
SetVal.setString(target[0],“month\_name”,“May”);  
SetVal.setString(target[0],“quarter”,“Q2”);  
break;  
case 6:  
SetVal.setString(target[0],“month\_name”,“June”);  
SetVal.setString(target[0],“quarter”,“Q2”);  
break;  
case 7:  
SetVal.setString(target[0],“month\_name”,“July”);  
SetVal.setString(target[0],“quarter”,“Q3”);  
break;  
case 8:  
SetVal.setString(target[0],“month\_name”,“August”);  
SetVal.setString(target[0],“quarter”,“Q3”);  
break;  
case 9:  
SetVal.setString(target[0],“month\_name”,“September”);  
SetVal.setString(target[0],“quarter”,“Q3”);  
break;  
case 10:  
SetVal.setString(target[0],“month\_name”,“October”);  
SetVal.setString(target[0],“quarter”,“Q4”);  
break;  
case 11:  
SetVal.setString(target[0],“month\_name”,“November”);  
SetVal.setString(target[0],“quarter”,“Q4”);  
break;  
case 12:  
System.out.println(“case 12:”+saleDate.getMonth());  
SetVal.setString(target[0],“month\_name”,“December”);  
SetVal.setString(target[0],“quarter”,“Q4”);

}

SetVal.setInt(target[0],“year”,saleDate.getYear()+1900);

}catch(Exception ex){  
errorMessage=ex.getMessage()+" -\>occured with record :"+counter;  
System.out.println(errorMessage);  
ex.printStackTrace();  
return false;  
}  
counter++;  
return true;  
}  
}

here is run methode of split

public void run()  
{  
boolean isDriverDifferent;

// get all ports involved  
InputPort inPort = getInputPort(0);  
DataRecord driverRecordread = new DataRecord(inPort.getMetadata());  
driverRecordread.init();

int index=0;

// get array of all ports defined/connected - use collection Collection - getInPorts();  
OutputPort outPorts;  
outPorts = (OutputPort) getOutPorts().toArray(new OutputPort[0]);

// create array holding incoming records  
DataRecord outputRecords;  
outputRecords = new DataRecord[outPorts.length];

// initialize array of data records (for each input port one)  
for (int i = 0; i \< outPorts.length; i++)  
{  
outputRecords[i] = new DataRecord(outPorts[i].getMetadata());  
outputRecords[i].init();  
}

// numActive=inPorts.length;  
int cou = new int[5];

while (runIt)  
{  
try  
{  
driverRecordread = inPort.readRecord(driverRecordread);  
if(driverRecordread != null)  
{  
outputRecords[0]=driverRecordread.duplicate();  
outputRecords[1]=driverRecordread.duplicate();  
outputRecords[0].delField(0);  
outputRecords[0].delField(2);  
outputRecords[0].delField(3);  
outputRecords[0].delField(4);  
outputRecords[0].delField(5);  
outputRecords[0].delField(6);  
outputRecords[0].delField(7);  
outputRecords[0].delField(8);  
outputRecords[0].delField(9);  
outputRecords[1].delField(1);  
// This Function Will always Return zero.  
int result\_t = 0;  
outPorts[0].writeRecord(outputRecords[0]);  
outPorts[1].writeRecord(outputRecords[1]);  
// System.out.println(“In Run: index” + result\_t);  
}else  
{  
break;  
}  
} catch (IOException ex)  
{  
resultMsg = ex.getMessage();  
resultCode = Node.RESULT\_ERROR;  
closeAllOutputPorts();  
System.out.println(“IO error in split:” + ex.getMessage());  
ex.printStackTrace();  
return;  
} catch (Exception ex)  
{  
resultMsg = ex.getMessage();  
resultCode = Node.RESULT\_FATAL\_ERROR;  
System.out.println(“error in split:” + ex.getMessage());  
ex.printStackTrace();  
return;  
}  
}

broadcastEOF();

if (runIt) {  
resultMsg = “OK”;  
} else  
{  
resultMsg = “STOPPED”;  
}  
resultCode = Node.RESULT\_OK;  
}

please help me quickly to implement this split record component

---

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 8:23am UTC](https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59/2 "2007-07-16T08:23:44Z")

</div>

yea martin

i have registered my componenet. the new line i added is look like

registerComponent(SplitRecord.COMPONENT\_TYPE,“org.jetel.component.SplitRecord”);

---

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 8:23am UTC](https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59/3 "2007-07-16T08:23:45Z")

</div>

hello sir

i try to trace the problem so i have print stack trace and get the cause of exception

in read methode of TransformationGraphXMLReaderWriter if make following change

catch (Exception ex) {  
ex.printStackTrace();  
//throw new RuntimeException(ex);  
}

after making this change i get that exception i nullpoint exception at sentence

graphNode.setPhase(phaseNum);

in instantiateNodes function.

so i print phase to know whether it initialized properly  
my code is like  
graphNode = ComponentFactory.createComponent(nodeType,  
nodeElements.item(i));  
System.out.println("phase No. " +phaseNum);  
graphNode.setPhase(phaseNum);

now on executing i get output as

\*\*\* CloverETL framework/transformation graph runner ver1.7, (c) 2002-05 D.Pavlis, released under GNU Lesser General Public License \*\*\*

Graph definition file: E:/CloverETL/Examples/graphsplit.txt  
phase No. 0  
phase No. 0  
java.lang.NullPointerException  
at org.jetel.graph.TransformationGraphXMLReaderWriter.instantiateNodes(TransformationGraphXMLReaderWriter.java:381)  
at org.jetel.graph.TransformationGraphXMLReaderWriter.instantiatePhases(TransformationGraphXMLReaderWriter.java:348)  
at org.jetel.graph.TransformationGraphXMLReaderWriter.read(TransformationGraphXMLReaderWriter.java:242)  
at org.jetel.main.runGraph.main(runGraph.java:124)  
Initializing DB connection: jdbc:postgresql://192.168.0.3/olap … OK  
Initializing DB connection: jdbc:postgresql://192.168.0.3/vtech0506 … OK  
[Clover] starting WatchDog thread …  
[WatchDog] Thread started.  
[WatchDog] Running on 1 CPU(s) max available memory for JVM 1635 KB  
[Clover] Initializing phase: 0  
initializing edges: all edges initialized successfully…  
initializing nodes:  
INPUT …FAILED !  
Nov 10, 2005 5:43:00 PM org.jetel.graph.Phase init  
SEVERE: At least one output port has to be defined for node INPUT  
[WatchDog] !!! Phase finished with error - stopping graph run !!!  
Failed starting graph !  
[Clover] WatchDog thread finished - total execution time: 0 (sec)  
[Clover] !!! Graph execution finished with errors !!!

i get phase no for first two node but on third node throw exception

one another thing is that thow in my graph definition output port for “INPUT” is defined, still INPUT failed to initialized with reason that it has not output port.

can any body figure out problem?

---

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 8:23am UTC](https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59/4 "2007-07-16T08:23:46Z")

</div>

hello martin  
that exclamations mark is not in original graph, this kept here by mistake. actualy i have commented some code for testing where is problem. after getting that when i include SPLIT node i get error i ahve removed comment for posting here and that time i forget to remove this

---

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 8:23am UTC](https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59/5 "2007-07-16T08:23:47Z")

</div>

Hello,  
on second read your code i have second question. Are you sure that you register your new component in ComponentFactory class? There is static initialization block for all accessible component.

Martin

---

<div class="post-metadata">

**Author:** ![oldforum](https://avatars.discourse-cdn.com/v4/letter/o/13edae/32.png) [@oldforum](https://forum.cloverdx.com/u/oldforum)\
**Post date:** [July 16, 2007, 8:23am UTC](https://forum.cloverdx.com/t/fatal-error-during-graph-initialization/59/6 "2007-07-16T08:23:48Z")

</div>

Hello Deepak,  
can i ask you why do you have two exclamations in this lines: (?)

It seems like INPUT node dont has output edge connect. Its my first idea when i looked at your code.

OtaSanek
