How to solve java.net.UnknownHostException: mosquitto in docker container? - java

I am running a Java application which successfully connects to a MQTT broker locally like this:
ws://localhost:9001 and then has to do the same in a docker container for ws://mosquitto:9001. This used to work fine but I found now that I get this issue:
Failed to connect to the MQTT broker with address ws://mosquitto:9001 MqttException (0) - java.net.UnknownHostException: mosquitto
I receive no other error so I wonder what could be the cause of this since it used to work fine before.

you may go to https://github.com/eclipse/mosquitto/issues/2074
where scott has mentioned
This broke for me when Watchtower upgraded this to 2.0.7 also. Adding the following to the config file and a restart fixed things for me:
listener 1883

Related

How to limit AEM access to localhost?

To load some code, I need a clean local AEM Author instance running on my laptop. I start it using CLI like :
bash$ java -jar aem-author-p4502.jar -nointeractive
Default user/password is then admin/admin to access AEM on http://localhost:4502. I'm ok with that but I've tested from another computer and port 4502 is open from full local network.
I'd like to limit access only from localhost, maybe by configuring listener address to 127.0.0.1 only. How ?
Recent AEM versions uses Apache Felix Lightweight HTTP Service as HTTP Server. I found how to bind it to 127.0.0.1 when it is embedded in AEM.
Configuration file is crx-quickstart/launchpad/config/org/apache/felix/http.config. I added last line :
:org.apache.felix.configadmin.revision:=L"1"
org.apache.felix.http.session.timeout=I"10"
org.apache.felix.https.jetty.protocols.excluded=[ \
"SSLv3", \
]
org.apache.felix.proxy.load.balancer.connection.enable=B"true"
service.pid="org.apache.felix.http"
org.apache.felix.http.host="127.0.0.1"
Now AEM Author is available only from localhost.
Maybe you can try to add an exception on your firewall to the port 4502 and only enable connections from your local and deny the others.
Regards,

Weblogic 11g: Managed Server is not starting from Weblogic console

i have some strange situation:
When i am trying to start managed server on the console i get the following error on Nodemanager:
PM weblogic.nodemanager.server.Handler run
WARNING: I/O error while closing socket connection
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:135)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at weblogic.utils.io.ChunkedInputStream.read(ChunkedInputStream.java:159)
at weblogic.security.SSL.jsseadapter.JaSSLEngineRunner$Context.fillBufferNetIn(JaSSLEngineRunner.java:323)
at weblogic.security.SSL.jsseadapter.JaSSLEngineRunner$Transition_NeedUnwrap.getNextState(JaSSLEngineRunner.java:822)
at weblogic.security.SSL.jsseadapter.JaSSLEngineRunner.doTransitions(JaSSLEngineRunner.java:763)
at weblogic.security.SSL.jsseadapter.JaSSLEngineRunner.closeInbound(JaSSLEngineRunner.java:1279)
at weblogic.security.SSL.jsseadapter.JaSSLEngineRunner.close(JaSSLEngineRunner.java:1365)
at weblogic.security.SSL.jsseadapter.JaAbstractSSLSocket.close(JaAbstractSSLSocket.java:245)
at weblogic.nodemanager.server.Handler.run(Handler.java:85)
at java.lang.Thread.run(Thread.java:745)
But when i am trying to start Managed Servers from command-line then it works correctly:
nohup ./startManagedWebLogic.sh server1 t3://xx.xx.xx.xx:7001 >/dev/null 2>&1 &
In oracle Documentation i found that this issue can happen when in nodemanager.properties file the following line is set to false:
NativeVersionEnabled=false
After i set it to true the issue is still persists.
The issue started after i did an Upgrade for Java from java jrockit to java JDK 1.80. I have also changed the certificates from Demo to custom.
Did someone had this issue before and knows how to fix it?
In the nodemanager.properties file set the SecureListener attribute to false.
In the weblogic server admin console, configure the machine to not use a secured connection with the node manager (Node Manager tab)
These 2 options configure a non secured connection between the admin server and the node manager.

Apache Flink throws UnknownHostException on cluster

I have a flink project that is connecting to nifi to pull data. The setup to pull get the datastream works just fine when running locally.
.url("http://1.2.3.4:8080/nifi")
.portName("MyPortName")
.requestBatchCount(5)
.buildConfig();
But when I add the .jar to the remote cluster and run the job it throws this:
java.net.UnknownHostException
at sun.nio.ch.Net.translateException(Net.java:177)
at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:127)
at org.apache.nifi.remote.client.socket.EndpointConnectionPool.establishSiteToSiteConnection(EndpointConnectionPool.java:712)
at org.apache.nifi.remote.client.socket.EndpointConnectionPool.establishSiteToSiteConnection(EndpointConnectionPool.java:685)
at org.apache.nifi.remote.client.socket.EndpointConnectionPool.getEndpointConnection(EndpointConnectionPool.java:301)
at org.apache.nifi.remote.client.socket.SocketClient.createTransaction(SocketClient.java:129)
at org.apache.flink.streaming.connectors.nifi.NiFiSource.run(NiFiSource.java:90)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:78)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:55)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask.run(SourceStreamTask.java:56)
at org.apache.flink.streaming.runtime.tasks.StoppableSourceStreamTask.run(StoppableSourceStreamTask.java:39)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:272)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:655)
at java.lang.Thread.run(Thread.java:745)
The only reason I can find for an UnknownHostException is that it is because the IP of the host name can't be resolved, but I am giving the IP already. There was an issue earlier with it being unable to connect to nifi because I have to set what IP is allowed to access the nifi instance. So I added the AWS server as allowed and it fixed that, but obviously I have this now.
Any help is greatly appreciated!
I figured the problem. I had my nifi cluster and my flink cluster in different regions. Moved the flink cluster to the same region and used either the public or private url for the cluster and it works fine.

Communication between spring boot dockerized apps

I new using spring boot and docker and I faced a problem running the docker containers.
On debug mode, there is no problem on applications boot, but when I run them as a container, there is something wrong.
For example, I have my server config with all the yml files, also eureka properties.
The config server boot perfectly, but not the eureka server, it must look for it`s configuration to the config server becouse of these:
uri: ${vcap.services.config-service.credentials.uri:http://127.0.0.1:8888}
In the eureka`s log I can found:
Could not locate PropertySource: I/O error on GET request for
"http://127.0.0.1:8888/server-eureka/default":Connection refused;
nested exception is java.net.ConnectException: Connection refused
So I see that eureka cant connect to the config server for a reason I cant understund.
Maybe I miss something in my docker file.
If you are not using docker linked containers you'll have to use only the public ip addresses. Docker will assign every running container an own ip address which is per default not accessible. Only when you start to expose ports there will be an entry to iptables that is linking the hosts public ip address and given port to the internal used port and (dynamically assigned) ip address of the docker container. This is also why 127.0.0.1 does not work cause it would look into the containers local context but tgere the service is not running.

javax.naming.CommunicationException When enabling a firewall

I'm getting the following error when i'm trying to connect via RMI to a JBoss application
javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ClientContainer]
This error occurs only after enabling IPtables on a linux server.
At the moment, we use this application as a logging tool between 2 servers, but it all Ports to be open because RMI uses random ports for the export of objects if i'm not mistaken
We have tested with some small test applications and the following is a viable solution when using firewalls with RMI:
UnicastRemoteObject.exportObject(server, 1244);
I export the object over port 1244
The following ports are open at this moment:
1244: The RMI-export object
1066: Binding with RMI on the server
1099: Registering on the management server
Is there anybody that could push me in the right direction to get this implementation working?
Thanks in advance!

Categories

Resources