Apache Karaf root instance already running

Pranav Maniar picture Pranav Maniar · Jun 7, 2016 · Viewed 7.5k times · Source

I am new to apache karaf.
When I start the apache karaf by executing bat file on my windows machine. It keeps giving me below error

C:\karaf\apache-karaf-4.0.5\bin>karaf.bat
There is a Root instance already running with name root and pid 1320

I checked for this pid, but there is no process with that pid.

I also checked the process in the task manager, but no process with name kafar / root is running.

Answer

Pranav Maniar picture Pranav Maniar · Jun 7, 2016

I figured it out.
It seems that If we close the command window (without hitting ^D) then the pid stored does not gets cleared
Next time when it starts up, karaft reads the old pid from the properties file. Ofcourse the old process does not exist anymore, but since pid was not cleared from property file, apache karaf does not know it.

Solution :

  • Open KARAF_HOME\instances\instance.properties file
  • Set item.0.pid=0

Alternatively in development deleting KARAF_HOME\instances\instance.properties file would also work. On next startup it will create the instance.properties file