Thingsboard I/O error on POST request - thingsboard

I'm trying to create a plugin that posts the data it receives from devices to another application. However, I don't see any data coming in on my application. When I look at the plugin's error events I see the following stack trace:
org.thingsboard.server.extensions.api.rules.RuleException: I/O error on POST request for "http://127.0.0.1:7890/stream/gps":
Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
at org.thingsboard.server.extensions.rest.plugin.RestApiCallMsgHandler.process(RestApiCallMsgHandler.java:64)
at org.thingsboard.server.extensions.api.plugins.AbstractPlugin.process(AbstractPlugin.java:47)
at org.thingsboard.server.actors.plugin.PluginActorMessageProcessor.onRuleToPluginMsg(PluginActorMessageProcessor.java:101)
at org.thingsboard.server.actors.plugin.PluginActor.onRuleToPluginMsg(PluginActor.java:93)
at org.thingsboard.server.actors.plugin.PluginActor.onReceive(PluginActor.java:52)
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:167)
at akka.actor.Actor$class.aroundReceive(Actor.scala:480)
at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:97)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke(ActorCell.scala:495)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST
request for "http://127.0.0.1:7890/stream/gps": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:633)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:498)
at org.thingsboard.server.extensions.rest.plugin.RestApiCallMsgHandler.process(RestApiCallMsgHandler.java:48)
... 16 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:78)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:619)
... 19 more
I've quickly set up a node server to test if the data is being sent.
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
app.use(cors());
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.all('*', (req, res, next) => {
console.log('received request');
next();
});
app.get('/', (req, res, next) => {
res.status(200).send('It works');
next();
});
app.post('/stream/gps', (req, res, next) => {
console.log(req.body);
res.status(200).json(req.body);
next();
});
app.listen(7890, () => {
console.log('Server listening on port 7890');
});
and when I do a post with insomnia or postman to the url, I get a 200 success

Found the problem, running the Thingsboard inside a docker container, so localhost === container localhost, not my device where I run the node server

Related

Jenkins connection refused trying to use Appium

I want to execute the tests that work fine on my local ide, on the corporate jenkins now.
Im getting an "Errno 111" connection refused message at this part:
def driver_setup():
driver = webdriver.Remote( "http://localhost:4723/wd/hub",
desired_capabilities= capabilities)
Jenkins is giving me this log
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.1.1', port=4723): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f16c2f921c0>: Failed to establish a new connection: [Errno 111] Connection refused'))

Jenkins slave connection using SSH

I have a Ubuntu master machine and windows 10 slave machine
I need to connect slave machine(windows machine) from master machine(ubuntu) using SSH Connection
Followed the below link
https://devopscube.com/setup-slaves-on-jenkins-2/
attached node details and global credential configuration:
Faced the below issue while launching. please help me on this
[05/08/17 06:26:10] [SSH] Opening SSH connection to 172.16.108.233:22. Connection timed out (Connection timed out) SSH Connection failed with IOException: "Connection timed out (Connection timed out)". java.io.IOException: There was a problem while connecting to
172.16.108.233:22 at com.trilead.ssh2.Connection.connect(Connection.java:818) at com.trilead.ssh2.Connection.connect(Connection.java:687) at com.trilead.ssh2.Connection.connect(Connection.java:587) at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1198) at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:724) at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:719) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.ConnectException: Connection timed out (Connection timed out) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:354) at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:467) at com.trilead.ssh2.Connection.connect(Connection.java:758) ... 9 more [05/08/17 06:28:21] Launch failed - cleaning up connection [05/08/17 06:28:21] [SSH] Connection closed.
Note: In Slave machine Git only installed(Jenkins not installed)
In the key configuration you should put the private key not the public key
And in the slave machine you don't need to install Jenkins

Hello, can some one help me

00:00:01,564 ERROR [org.hornetq.core.client] (Thread-11 (HornetQ-server-HornetQServerImpl::serverUUID=a515fe69-fa14-11e5-8ce4-d54dd29e8524-1886871820)) HQ214016: Failed to create netty connection: java.net.SocketTimeoutException: connect timed out
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [rt.jar:1.8.0_74]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) [rt.jar:1.8.0_74]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) [rt.jar:1.8.0_74]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) [rt.jar:1.8.0_74]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) [rt.jar:1.8.0_74]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) [rt.jar:1.8.0_74]
at java.net.Socket.connect(Socket.java:589) [rt.jar:1.8.0_74]
at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.connect(OioClientSocketPipelineSink.java:109) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
at org.jboss.netty.channel.socket.oio.OioClientSocketPipelineSink.eventSunk(OioClientSocketPipelineSink.java:69) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
at org.jboss.netty.channel.Channels.connect(Channels.java:634) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
java.net.SocketTimeoutException: connect timed out
You failed to connect to your destination. Nobody can tell you anything different without some actual code.
It seems that your server is not running or you are giving wrong server info so you are getting
java.net.SocketTimeoutException: connect timed out
If you attach your code snippet it would be helpful

spring-amqp detect ConnectException

How can i detect this exception when i start my application:
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection timed out: connect
The project is configured in the Spring way (http://projects.spring.io/spring-amqp/) and I can see the errors in the logs, but I can't detect it in my java Classes.
Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection timed out: connect
Restarting Consumer: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
Failed to check/redeclare auto-delete queue(s).org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection timed out: connect
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:54)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:217)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:444)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1035)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1028)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1004)
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:254)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:947)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$300(SimpleMessageListenerContainer.java:82)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1065)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at com.rabbitmq.client.impl.FrameHandlerFactory.create(FrameHandlerFactory.java:32)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:615)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:651)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:208)
... 12 more
This can happen for example when you have no access to the AMQP port.
Thank you!
There is currently no event emitted when this error occurs (I have created a JIRA issue to add one.
In the meantime, since the the connection is shared, you could call createConnection() on the connection factory from your own code from time to time, to check the connection state.
Or, you could hook into the logging subsystem to capture the WARN log, as I described in this answer.

Flume Error: connection refused

Please Have a look at the following error:
Flume Code:
local1.channels.mem-ch-1.type = memory
local1.sources.exc-src-1.channels = mem-ch-1
local1.sources.exc-src-1.type = exec
local1.sources.exc-src-1.command =tail -F /u01/accts/a.ntimbadi/flumtest.txt
local1.sinks.avro-snk-1.channel = mem-ch-1
local1.sinks.avro-snk-1.type = avro
local1.sinks.avro-snk-1.hostname = localhost
local1.sinks.avro-snk-1.port = 4141
local1.sources = exc-src-1
local1.sinks = avro-snk-1
local1.channels = mem-ch-1
Error Log:
org.apache.flume.EventDeliveryException: Failed to send events
at org.apache.flume.sink.AbstractRpcSink.process(AbstractRpcSink.java:382)
at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:68)
at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.flume.FlumeException: NettyAvroRpcClient { host: localhost, port: 4141 }: RPC connection error
at org.apache.flume.api.NettyAvroRpcClient.connect(NettyAvroRpcClient.java:145)
at org.apache.flume.api.NettyAvroRpcClient.connect(NettyAvroRpcClient.java:101)
at org.apache.flume.api.NettyAvroRpcClient.configure(NettyAvroRpcClient.java:564)
at org.apache.flume.api.RpcClientFactory.getInstance(RpcClientFactory.java:88)
at org.apache.flume.sink.AvroSink.initializeRpcClient(AvroSink.java:127)
at org.apache.flume.sink.AbstractRpcSink.createConnection(AbstractRpcSink.java:209)
at org.apache.flume.sink.AbstractRpcSink.verifyConnection(AbstractRpcSink.java:269)
at org.apache.flume.sink.AbstractRpcSink.process(AbstractRpcSink.java:339)
... 3 more
Caused by: java.io.IOException: Error connecting to localhost/127.0.0.1:4141
at org.apache.avro.ipc.NettyTransceiver.getChannel(NettyTransceiver.java:261)
at org.apache.avro.ipc.NettyTransceiver.<init>(NettyTransceiver.java:203)
at org.apache.avro.ipc.NettyTransceiver.<init>(NettyTransceiver.java:152)
at org.apache.flume.api.NettyAvroRpcClient.connect(NettyAvroRpcClient.java:131)
... 10 more
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:599)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:396)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:358)
at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:274)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... 1 more
Let me know if I am doing something wrong. I am actually trying to create an avro sink here and then redirect it with other agent(whose code is not here) to HDFS. I seem to have error connecting to the port at localhost. Please suggest some solution.
Your configuration is to read events from the exec source and send them on using Avro on localhost:4141.
However, the error log indicates that you do not have an Avro source running at localhost:4141.
You'll be needing an Avro source (maybe another agent) listening on that port.

Resources