Getting NettyTcpClient connection error with Spring WebSocket with amqp broker (rabbitmq) while running in docker - spring

I am trying to use the rabbitmq as the StompBroker in the WebSocketConfig. Have added the dependencies reactor-core and reactor-net
It works fine when starting up locally (localhost) but when I try to start the project as a docker container (rabbitmq image is correctly built with STOMP plugin), I get below error.
r.io.net.impl.netty.tcp.NettyTcpClient : Failed to connect to /127.0.0.1:61613. Attempting reconnect in 5000ms
I tried setting the setRelayHost("rabbitmq") and setRelayPort(61613) (since rabbitmq is the service name in the docker compose, using it to resolve the host name). No luck still.

Related

RabbitMQ Stream Exception using a Dockerized Spring Boot Application

When starting up Spring Boot I get the following error:
Failed to start bean
'org.springframework.amqp.rabbit.config.internalRabbitListenerEndpointRegistry';
nested exception is com.rabbitmq.stream.StreamException
and the cause of the error is:
java.net.UnknownHostException: 4e31343111e9: Temporary failure in name
resolution
The authentication passes fine for RabbitMQ - if I change the credentials then it fails at that before even reaching this stage.
Spring Boot is running using a Docker container and the RabbitMQ host is also on another host running in a container (with 5552 port open).
The error was that there was no advertised host and port for streams in the rabbit instance - this was resolved once that was added as the explicit host IP address.

ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter

I am trying to connect my application to Signoz. It only works when both application and Signoz are running in the same machine. If I pull the application in another machine, I am getting timed out error.
ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export spans. The request could not be executed. Full error message: connect timed out
My application is deployed in Wildfly so I have add the following JAVA_OPTS to the standalone.conf.bat
set "JAVA_OPTS=%JAVA_OPTS% -javaagent:c:/signoz/opentelemetry-javaagent.jar -Dotel.metrics.exporter=none -Dotel.exporter.otlp.endpoint=http://MyOtherServer:4318 -Dotel.resource.attributes=""service.name=MyService"""
opentelemetry-javaagent by default expects gRPC protocol that is usualy listening on port 4317.
If your collector listens on 4318, it is otlp-http. That means you must also set
-Dotel.exporter.otlp.protocol=http/protobuf
Source: https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md#otlp-exporter-span-metric-and-log-exporters

How to deploy a spring boot application to tomcat server from jenkins?

Sample Spring boot application is created and build on Jenkins.
For Deployment of war file in tomcat server ,
I am facing a several issues.
Error :
Credentials At Jenkins :
tomcat-users.xml File :
Still I am facing the same issue. I had searched in google and stackoverflow but still i can't found the correct answer.
Can Any one help me in this ?
Your error message is a connection refused: connect exception. You should check the following:
Your Tomcat server is up and running on port 8082 at the same server where your jenkins server is running (localhost). To make sure, run: telnet localhost 8082 from the same server commandLine ( I see you are in windows). If it connects then your Tomcat server is OK.
Check if the manager application of Tomcat is deployed. Try to load the following web page and check if exists: http://localhost(or hostname of server):8082/manager/html
Try to disable the windows firewall and any other firewall you may have (or antivirus firewall) and check if it prevents jenkins to connect to Tomcat (again check with telnet command)

Jmeter plugin perfMon not listening to localhost

In jMeter, I have installed perfMon plugin that listens to 4444 port successfully. My application runs on localhost:8080. It seems when I give default http port as 8080 as per the attached image, api works fine but no graph for perfMon metric plugin. But when I give http default port as 4444, perfMon shows graph but API fails giving 404.
How can I run both my application in localhost:8080 and listen to same port using server agent/ perfMon agent (which runs on 4444 port)?
FYI. I need to monitor the tomcat server(where my tested application resides).For that I have installed server-agent in my tomcat server.Edited jmeter.properties like below: remote_hosts=localhost:4444
I am running my application in tomcat of docker container and I have installed perfMon server agent locally at my system /opt directory. Does it has to installed somewhere specific directory ?
In server agent console, I am getting error
ERROR 2018-03-09 13:25:19.126 [kg.apc.p] (): Error getting metric
org.hyperic.sigar.SigarException: No such process: 728
at org.hyperic.sigar.SigarProxyCache.invoke(SigarProxyCache.java:220)
at com.sun.proxy.$Proxy0.getProcCpu(Unknown Source)
at kg.apc.perfmon.metrics.CPUProcMetric.getValue(CPUProcMetric.java:35)
at kg.apc.perfmon.PerfMonMetricGetter.getMetricsLine(PerfMonMetricGetter.java:114)
at kg.apc.perfmon.PerfMonWorker.processSenders(PerfMonWorker.java:280)
at kg.apc.perfmon.PerfMonWorker.run(PerfMonWorker.java:243)
at java.lang.Thread.run(Thread.java:748)
as I have set the pid in metric parameter as follows(my tomcat pid =728 in docker)
every time after hitting API in jMeter, it is saying client disconnted
I got the solution. When it says "client disconnected", it is not an error, it is info. I forgot to change pid in metric parameter whenever I run the server.

Kafka container timeout

I have deployed hyperldger-fabric kafka based ordering service using ansible on aws. Everything working fine for me till yesterday. Today when I launch a network , kafka container unable to communicate with zookeeper. Here are docker logs of kafka containers
[2017-11-16 08:23:36,075] FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:155)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:129)
at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89)
at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71)
at kafka.server.KafkaServer.initZk(KafkaServer.scala:278)
at kafka.server.KafkaServer.startup(KafkaServer.scala:168)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
at kafka.Kafka$.main(Kafka.scala:67)
at kafka.Kafka.main(Kafka.scala)
[2017-11-16 08:23:36,077] INFO shutting down (kafka.server.KafkaServer)
[2017-11-16 08:23:36,080] INFO shut down completed (kafka.server.KafkaServer)
[2017-11-16 08:23:36,081] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:155)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:129)
at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89)
at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71)
at kafka.server.KafkaServer.initZk(KafkaServer.scala:278)
at kafka.server.KafkaServer.startup(KafkaServer.scala:168)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
at kafka.Kafka$.main(Kafka.scala:67)
at kafka.Kafka.main(Kafka.scala)
[2017-11-16 08:23:36,082] INFO shutting down (kafka.server.KafkaServer)
I havent change any code or anything else that's why I am unable to figure out what causes the problem . Any trick to solve this issue?
Finally fixed that issue. It was due to iptables setting which blocks icmp packets to be forwarded from flannel interface to docker interface thus docker containers couldn't communicate to each other. By adding iptable rules everything works fine for me .

Resources