The use of anonymous queues seems to be broken in Java 8. Running with Java 7 works fine. The problem appears to be with the call in AmqpAdmin.declareQueue(). This call results in a connection exception. I have a project which demonstrates it here.
Environment:
MacOS Yosemite
Java 1.8.0_20
Spring AMQP 1.4.3 (plus Spring Boot for convenience)
** Update **
It appears as though connecting as localhost is the problem with Java 8 - when I override the default ConnectionFactory and create my own and explicitly set the host to 127.0.0.1 the connection refused error goes away. There must be some difference in handling with Java's InetSocketAddress as the exception occurs in the Spring AMQP's FrameHandlerFactory line 32 where it tries to create the connection using the host name (which was localhost before). I updated the github project with the change.
Related
We are deploying several services in docker swarm (16 services in total) in a single master node. Most of these services are developed in Quarkus, some of them compiled in native mode, others are java compiled because of their dependencies.
When the services are in use everything works fine, but if they are waiting to be used for more than 15 minutes we start to receive this message:
Caused by: java.net.SocketException: Connection reset,
at java.net.SocketInputStream.read(SocketInputStream.java:186),
at java.net.SocketInputStream.read(SocketInputStream.java:140),
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137),
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153),
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280),
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138),
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56),
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259),
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163),
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157),
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273),
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125),
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272),
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186),
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89),
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110),
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185),
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83),
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56),
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:302),
It doesn't matter if it is native compilation or Java compilation, in all of them the novelty is reproduced.
This message is presented when trying to consume the API also built in Quarkus, its consumption is through Swarm's internal network using the name of the service to resolve its location.
To consume the api we build a jar, in which we implement the services interfaces as indicated in the guide https://quarkus.io/guides/rest-client using additionally org.eclipse.microprofile.faulttolerance for the retry.
Because of lack of communication through the socket your connection is lost.
I found few solutions here: Apache HttpClient throws java.net.SocketException: Connection reset if I use it as singletone
I trying to connect to a Neo4J version 3.5 database hosted by Graphene using .Net client 4.1.6 which uses driver 4.2 in .NET. I am getting this error:
Connection with the server breaks due to IOException: Unexpected end of stream when performing handshake, read returned 0 Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0.
A number of things to note:
I am able to connect to the database using an old version of my app (driver 1.7), so I know the database is accessible
I am able to connect to a local copy of my 3.5 database so I know its not a driver compatibility issue
I am able to connect my Neo4J browser remotely to my Graphene hosted database which is another indication that the database is accessible
I am not able to downgrade the version of the driver in my new app. I tried to set Encryption level to EncryptionLevel.Encrypted. Any help as to why this error is occuring would be helpful.
Getting the below exception while starting the spring boot application.
Exception:
Caused by: org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /null/swagger-resources/configuration/ui
Swagger gradle dependencies versions are as below
compile('io.springfox:springfox-swagger2:2.7.0')
compile('io.springfox:springfox-swagger-ui:2.7.0')
you need close like this browser tab.
my spring boot application port is 8888, when i close this tab and restart my spring boot application, the error is gone.
Hopefully it is the issue with IntelliJ editor. I'm running multiple microservices on different ports and shutting them down once the work is done, but IJ editor might have cached the port(which it already shut down) and causing this confusion and error. I have restarted the service with a different port, and the error is gone.
Note: In general, we will get BIND ERROR : Address already in use, if any other service is running on the same port.
When attempting to run Boot inside Docker, using the adzerk/boot-clj image, I receive connection refused errors.
Specifically, when the container starts up, boot is started, and then a stack trace is output. The trace (which is not easy to copy and paste between computers with no connectivity) essentially is to do with downloading - https://github.com/boot-clj/boot/releases/download/2.7.2/boot.jar - and receiving "Connection refused" errors.
I’m asking, and answering this, question in the hope that it might help someone else.
Where to start?
My main problem was with a Docker + Clojure + Boot setup, specifically when running “boot” from inside the container. Doing this spewed out a stack trace. This is where my journey begins.
I’m using the adzerk/boot-clj image. I’ve used it locally (OSX) without issue, the problem I experienced was in using a VM (CentOS 7) hosted within a corporate data center.
docker run -ti adzerk/boot-clj
Issuing this starts up the container, the entry point is Boot, and it starts pulling down some jars, specifically boot.jar from Github. The resulting stack trace details several problems, but the crux of it was
“java.net.ConnectException: Connection refused” (connecting to Clojars.org:443)
Hmmm…
So instead of running Boot straight away in the container, I specified the container entry point as “—-entrypoint bash” so I can prod around a little.
So, wget - connection refused.
What about without Docker in the way. Same thing. Connection refused.
After a little wrangling with the network team, I found that the “https_proxy” env variable needs to be set on CentOS to route traffic out to the internet. A very specific issue to me in the situation.
However….
wget is now fine, both on the host, and inside the adzerk/boot-clj container. Boot however was not.
In an effort to simplify things even more, I took Docker out of the equation entirely, and used boot locally.
Installed java-1.8.0-openjdk.x86_64, installed Boot. Same problem.
So dug around a little, and found this - https ://github.com/boot-clj/boot-bin/issues/2
This was a start. It mentions setting the BOOT_JVM_OPTIONS, specifically https.proxyHost and https.proxyPort.
It still didn’t work… Arrrg.
OK, let’s take Boot out of the equation.
I wrote a test harness in Java, very simple that connects to https ://clojars.org and attempts to read the index page. Copied from https ://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html, and setting the JVM_OPTS.
It still fails. “Connection refused”
…. Weird beard.
I finally stumbled on this SO - https ://stackoverflow.com/questions/43695299/java-httpurlconnection-works-on-windows-and-fails-on-linux - specifically the answer from Stephen C
“Java doesn't necessarily respect your system's default proxy settings. Since you are able to "curl" the URL on the Linux machine, the most likely explanation is that Java is not using the proxy that you have configured. The following links explains various ways to configure the proxies for Java:”
So taking the first link - https ://stackoverflow.com/questions/120797/how-do-i-set-the-proxy-to-be-used-by-the-jvm - and the answer from Leonel
I issued “java -Dhttps.proxyHost=xxx -Dhttps.proxyPort=80 HelloWorld”
I get an error, but a different one. This is progress. “Unable to tunnel through proxy”
A quick Google of this led me here: http ://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html - “Disable Basic authentication for HTTPS tunneling”
So updated to “java -Dhttps.proxyHost=xxx -Dhttps.proxyPort=80 -Djdk.http.auth.tunneling.disabledSchemes=“” HelloWorld
Profit.
Info:
java -v
openjdk version 1.8.0_144
Openjdk Runtime Environment (build 1.8.0_144-b01)
OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)
Sorry for all my profanity Boot.
I am trying to setup Neo4j version 3.2.0 in the ubuntu server 14.04.2 LTS
Downloaded the tar and extracted the folder, edited the config file to update the port to 4444, for the time being disabled the bolt connector, listen_address to 0.0.0.0 for the http connector, authentication also disabled just to get started.
bolt connector is updated with the port 7687 even though it is disabled as i was trying earlier with it enabled.
Now when i try to connect to the http://serverip:4444/browser, it says Database access not available and shows me the login screen with host prefilled bolt://serverip:7687
Also I see this error on the console window
WebSocket connection to ws://serverip:7687/
failed: Error in connection establishment:
net::ERR_CONNECTION_TIMED_OUT
Dont understand the issues here, please help me out. I am not sure why is it trying to do a WS to the port assigned to the bolt, when it is disabled at the first place.
Regards
There's a bit of juggling going on for HTTP connector support between the browser and the driver being used, a handoff which isn't complete, and the state of things is the browser is only supporting bolt connections right now.
The javascript bolt driver is being upgraded to handle http connections, I think, so you may need to wait until the next 3.2.x release to use the http connector again.
I think this issue should be tracking it.