# Running Graph with java

**URL:** <https://forum.cloverdx.com/t/running-graph-with-java/259>\
**Category:** CloverDX Platform\
**Created:** [December 13, 2007, 12:00am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259 "2007-12-13T00:00:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![elouan](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/elouan/32/88_2.png) [@elouan](https://forum.cloverdx.com/u/elouan)\
**Post date:** [December 13, 2007, 12:00am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/1 "2007-12-13T00:00:00Z")

</div>

Hello,  
I try to run a graph with a java class, so I take the example of the wiki and try to run graph.

```auto

Defaults.init();
Plugins.init("./cloverEtl/plugins/");
TransformationGraph graph = new TransformationGraph("./graph/graph.grf");
if(!graph.init()){
				System.err.println("Graph initialization failed !");

			  }

		if (graph.run() != Result.FINISHED_OK){
				System.out.println("Failed starting all nodes!");
		}

```

But when it arrive to the line of graph.init() exception is catch I don’t understand the problem.

```auto

FATAL [main] - No root Nodes detected! There must be at least one root node defined. (Root node is	node with output ports defined only.)
ERROR [main] - No root node!
org.jetel.exception.GraphConfigurationException: No root node!
	at org.jetel.graph.TransformationGraphAnalyzer.analyzeGraphTopology(TransformationGraphAnalyzer.java:89)
	at org.jetel.graph.TransformationGraph.init(TransformationGraph.java:466)
	at src.Lau.main(Lau.java:106)

```

Someone could help me ?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tchoua\_12](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tchoua\_12](https://forum.cloverdx.com/u/tchoua_12)\
**Post date:** [December 13, 2007, 11:20am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/2 "2007-12-13T11:20:46Z")

</div>

Hello,

I am not an expert but it seams that you have a problem into the graph structure.

Have you tried to run the graph example given with clover ?

Regards,

Tchoua

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [December 13, 2007, 11:41am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/3 "2007-12-13T11:41:22Z")

</div>

Hello,  
constructor TransformationGraph(String) creates new (empty) graph with given name. To read graph from xml file you have to use TransformationGraphXMLReaderWriter class (see javaExamples/testXMLGraph.java in example package).

---

<div class="post-metadata">

**Author:** ![elouan](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/elouan/32/88_2.png) [@elouan](https://forum.cloverdx.com/u/elouan)\
**Post date:** [December 13, 2007, 12:56pm UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/4 "2007-12-13T12:56:58Z")

</div>

Thanks to both of you.  
It works fine with TansformationGraphXmlReaderWriter.

---

<div class="post-metadata">

**Author:** ![elouan](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/elouan/32/88_2.png) [@elouan](https://forum.cloverdx.com/u/elouan)\
**Post date:** [December 13, 2007, 2:15pm UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/5 "2007-12-13T14:15:45Z")

</div>

Juste another question :  
Do I have to initialize the plugins, and Default before each Graph ?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [December 14, 2007, 8:20am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/6 "2007-12-14T08:20:19Z")

</div>

You have to initialize engine and plugins before you run a graph, so if you run more graphs from one application it suffices one initialization for all graphs.

---

<div class="post-metadata">

**Author:** ![elouan](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/elouan/32/88_2.png) [@elouan](https://forum.cloverdx.com/u/elouan)\
**Post date:** [December 14, 2007, 8:25am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/7 "2007-12-14T08:25:06Z")

</div>

Thank you for your answer avackova.

I have one more question, when i run the graph it ask me to use CheckConfig before.  
I do something like

```auto

ConfigurationStatus statut = new ConfigurationStatus();
graph.checkConfig(statut);

```

But I’m not convinced it’s the good way to do it.

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [December 14, 2007, 8:37am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/8 "2007-12-14T08:37:01Z")

</div>

It is correct way, but it is not necessary to do it if you know your graph is configured properly. If graph configuration is not correct method init will throw ComponentNotReadyException. Method checkConfig was introduced for GUI support purposes.

---

<div class="post-metadata">

**Author:** ![elouan](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/elouan/32/88_2.png) [@elouan](https://forum.cloverdx.com/u/elouan)\
**Post date:** [December 14, 2007, 8:38am UTC](https://forum.cloverdx.com/t/running-graph-with-java/259/9 "2007-12-14T08:38:14Z")

</div>

Thank you for all your answers.
