Vrankela
Vrankela

Reputation: 1202

I cant start context broker due to "error starting REST interface"

When I enter the following command:

/etc/init.d/contextBroker start

I get the following output:

Starting contextBroker...                         cat: /var/run/contextBroker/contextBroker.pid: No such file or directory
pidfile not found                                          [FAILED]

I have two machines where I am practising with context broker and I havent touched the second one in days after I succesfully installed it and managed to receive a post message from a remote weather station. I see that the directory /var/run/contextBroker/ is actually empty

What should I do to fix this now? reinstal context broker or? So is this somehow my fault and how do I prevent in the future? I dont want this happening when my app goes live.

EDIT1: the orion version is 0.20.0

EDIT2: I just reinstalled contextBroker and I get the same problem. What are exectly the contents of that directory? Could I maybe just create the files inside?

EDIT3: Since running contextBroker as a system service still yields an unsuccessful start, I also attempted to run it symply by typing:

contextBroker in the command line, after which I get the following response

INFO@14:03:03  contextBroker.cpp[1346]: Orion Context Broker is running
[root@localhost DevF12]# INFO@14:03:03  MongoGlobal.cpp[181]: Successful connection to database
INFO@14:03:03  contextBroker.cpp[1157]: Connected to mongo at localhost:orion
INFO@14:03:03  MongoGlobal.cpp[499]: Database Operation Successful ({ conditions.type: "ONTIMEINTERVAL" })
FATAL@14:03:03  rest.cpp[1013]: Fatal Error (error starting REST interface)

EDIT4: Ok so I tried ps aux | grep contextBroker and the result is:

494       2196  0.0  7.0 688696 135116 ?       Ssl  Apr21   0:02 /usr/bin/contextBroker -port 1026 -logDir /var/log/contextBroker -pidpath /var/run/contextBroker/contextBroker.pid -dbhost localhost -db orion
root      7299  0.0  6.9 621052 134440 ?       Ssl  04:21   0:00 contextBroker -port 1028
root      8870  0.0  0.0 103256   848 pts/0    S+   08:51   0:00 grep contextBroker

but there simply isnt anything in /var/run/contextBroker/ Should I put contextBroker.pid by myself? and if so, what should the contents be?

EDIT5: I just ran netstat -ntlpd | grep 1026 and the output is:

tcp        0      0 0.0.0.0:1026                0.0.0.0:*                   LISTEN      2196/contextBroker  
tcp        0      0 :::1026                     :::*                        LISTEN      2196/contextBroker 

So I guess nothing else but contextBroker is listening?

Upvotes: 1

Views: 353

Answers (1)

LeandroGuillen
LeandroGuillen

Reputation: 518

For the record (it was answered in the comments).

The message FATAL@XX:XX:XX rest.cpp[1013]: Fatal Error (error starting REST interface) means that there is a networking problem. Usually an interface or an already used port.

The usual cause is that there is another instance of Orion running (as a service, for example).

The way to solve it would be to kill the process entirely. Show all Orion processes with ps aux | grep contextBroker and issue a kill -9 <pid>, where <pid> is the process number (the second column of the output of the ps command).

Upvotes: 1

Related Questions