TimeoutException on a WebClient call while using JDK 11 - reactor-netty

There was an TimeoutException as shown below while using JDK 11 for WebClient:
Caused by: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 60000ms in 'source(MonoDefer)' (and no fallback has been configured)
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:295) ~[reactor-core-3.4.24.jar!/:3.4.24]
However, if JDK 8 were used then it works fine and no above TimeoutException with the same test case.
The application is built by using Spring Boot V2.7.5 with "spring-boot-starter-webflux". Here is the version of "reactor-netty-http" in the application:
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty-http</artifactId>
<version>1.0.24</version>
</dependency>
Here are the observations:
If idle enough time ( aobut 30 seconds ) after the call of a WebClient then below connnection was closed:
2022-11-14 11:17:47.773 DEBUG 7600 --- [ctor-http-nio-3] reactor.netty.http.client.HttpClient : [3d257d24, L:/xx.xx.xx.xx:64172 - R:nnctj2prxc4t.apps.internal.xxxx.net/xx.xx.xx.xx:443] READ COMPLETE
2022-11-14 11:18:17.264 DEBUG 7600 --- [ctor-http-nio-3] reactor.netty.http.client.HttpClient : [3d257d24, L:/xx.xx.xx.xx:64172 - R:nnctj2prxc4t.apps.internal.xxxx.net/xx.xx.xx.xx:443] READ COMPLETE
2022-11-14 11:18:17.265 DEBUG 7600 --- [ctor-http-nio-3] reactor.netty.http.client.HttpClient : [3d257d24, L:/xx.xx.xx.xx:64172 ! R:nnctj2prxc4t.apps.internal.xxxx.net/xx.xx.xx.xx:443] USER_EVENT: SslCloseCompletionEvent(java.nio.channels.ClosedChannelException)
2022-11-14 11:18:17.265 DEBUG 7600 --- [ctor-http-nio-3] reactor.netty.http.client.HttpClient : [3d257d24, L:/xx.xx.xx.xx:64172 ! R:nnctj2prxc4t.apps.internal.xxxx.net/xx.xx.xx.xx:443] INACTIVE
2022-11-14 11:18:17.265 DEBUG 7600 --- [ctor-http-nio-3] reactor.netty.http.client.HttpClient : [3d257d24, L:/xx.xx.xx.xx:64172 ! R:nnctj2prxc4t.apps.internal.xxxx.net/xx.xx.xx.xx:443] UNREGISTERED
As you can see, the HttpClient on the thread 'ctor-http-nio-3' was closed and unregistered after about 30 seconds with a SslCloseCompletionEvent(java.nio.channels.ClosedChannelException).
Then try to use the webclient again by sending a request. Here is an output which was successfully:
2022-11-14 11:18:59.542 DEBUG 7600 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [476de49d] REGISTERED
2022-11-14 11:18:59.630 DEBUG 7600 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [476de49d] CONNECT: nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443
2022-11-14 11:18:59.743 DEBUG 7600 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [476de49d, L:/xx.xx.xx.xx:64197 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] ACTIVE
2022-11-14 11:18:59.849 DEBUG 7600 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [476de49d, L:/xx.xx.xx.xx:64197 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] READ COMPLETE
2022-11-14 11:18:59.858 DEBUG 7600 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [476de49d, L:/xx.xx.xx.xx:64197 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] USER_EVENT: SslHandshakeCompletionEvent(SUCCESS)
2022-11-14 11:18:59.860 DEBUG 7600 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [476de49d-1, L:/xx.xx.xx.xx:64197 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] WRITE: 2023B
.
.
.
As you can see a new connection was registered on a new thread 'ctor-http-nio-4'. The call was successfully.
However if the connection was closed successfully - SslCloseCompletionEvent(SUCCESS) and unregistered. Here is an output:
2022-11-14 09:10:41.295 DEBUG 21332 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [9a6b8e52, L:/xx.xx.xx.xx:56897 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] CLOSE
2022-11-14 09:10:41.303 DEBUG 21332 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [9a6b8e52, L:/xx.xx.xx.xx:56897 ! R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] USER_EVENT: SslCloseCompletionEvent(SUCCESS)
2022-11-14 09:10:41.303 DEBUG 21332 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [9a6b8e52, L:/xx.xx.xx.xx:56897 ! R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] READ COMPLETE
2022-11-14 09:10:41.303 DEBUG 21332 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [9a6b8e52, L:/xx.xx.xx.xx:56897 ! R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] INACTIVE
2022-11-14 09:10:41.303 DEBUG 21332 --- [ctor-http-nio-4] reactor.netty.http.client.HttpClient : [9a6b8e52, L:/xx.xx.xx.xx:56897 ! R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] UNREGISTERED
Then try to use the webclient again by sending a request which is registered an new connection. Here is an output:
2022-11-14 09:11:32.362 DEBUG 21332 --- [ctor-http-nio-5] reactor.netty.http.client.HttpClient : [ad2bc21d] REGISTERED
2022-11-14 09:11:32.424 DEBUG 21332 --- [ctor-http-nio-5] reactor.netty.http.client.HttpClient : [ad2bc21d] CONNECT: nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443
2022-11-14 09:11:32.528 DEBUG 21332 --- [ctor-http-nio-5] reactor.netty.http.client.HttpClient : [ad2bc21d, L:/xx.xx.xx.xx:56922 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] ACTIVE
2022-11-14 09:11:32.970 DEBUG 21332 --- [ctor-http-nio-5] reactor.netty.http.client.HttpClient : [ad2bc21d, L:/xx.xx.xx.xx:56922 - R:nnctj2prxc4t.apps.internal.xxxxxx.net/xx.xx.xx.xx:443] READ COMPLETE
2022-11-14 09:11:33.063 DEBUG 21332 --- [ctor-http-nio-5] reactor.netty.http.client.HttpClient : [ad2bc21d, L:/xx.xx.xx.xx:56922 - R:nnctj2prxc4t.apps.internal.xxxxxx.net/xx.xx.xx.xx:443] READ COMPLETE
2022-11-14 09:11:33.063 DEBUG 21332 --- [ctor-http-nio-5] reactor.netty.http.client.HttpClient : [ad2bc21d, L:/xx.xx.xx.xx:56922 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] READ COMPLETE
2022-11-14 09:11:33.165 DEBUG 21332 --- [ctor-http-nio-5] reactor.netty.http.client.HttpClient : [ad2bc21d, L:/xx.xx.xx.xx:56922 - R:nnctj2prxc4t.apps.internal.xxxxx.net/xx.xx.xx.xx:443] USER_EVENT: SslHandshakeCompletionEvent(SUCCESS)
.
.
.
Caused by: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 60000ms in 'source(MonoDefer)' (and no fallback has been configured)
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:295) ~[reactor-core-3.4.24.jar!/:3.4.24]
As you can see, after the connection was closed successfully and unregistered then later call will result TimeoutException with a new registered connection.
Above issue occurred while using JDK 11 (zulu-jdk11.0.14) only. If use JDK 8 (zulu8.61.0.18-sa-jdk8.0.331) then everything is working fine.
I tried to use the same appliation with different JDK 8 and JDK 11. Using JDK 8, there is no issue for WebClient to connect to the REST API and get the data back successfully.
However, I tried to use JDK 11 then I got ReadTimeoutException.
The Application is built by using Spring Boot 2.7.5 which is the latest version. It is using WebClient to connect the REST API server. The built target is Java 8.
Even I tried to build the applicaiton with target Java 11 and running it in Java 11 but still getting the same error.
How can I solve this?

Related

Jsmpeg in Chrome cannot read websocket stream served by Spring Webflux

Problem description
Application implements Spring webflux websocket Netty server that forwards ffmpeg stream output to websocket protocol. This application allows multiple viewers to see the stream from their web browser by using jsmpeg javascript library.
This solution works as expected in Firefox web browser.
https://i.stack.imgur.com/X4Fm4.png
But in Chrome web browser the stream fails no load. Chrome browser cannot get data from the websocket connection.
Follows an screenshot of the problem seen in Chrome DevTools.
https://i.stack.imgur.com/xWvll.png
Question
What should be changed in this solution so that stream can be opened in Chrome?
How to reproduce the problem
Pull following git repository: https://github.com/haraldsegliens/spring-webflux-websocket-jsmpeg-chrome-problem/tree/master
Install FFMpeg: https://ffmpeg.org/download.html
Update ffmpeg-command variable in src/main/resources/application.yaml so it references the ffmpeg program in your system
Run Spring application. The application by default creates a following endpoint: ws://localhost:8080/stream
Open view_stream.html in Chrome browser
My research of the problem
Turned on TRACE logs and opened the stream in Chrome browser. I see following error in application logs:
2022-09-02 15:26:36.952 - DEBUG [reactor-http-nio-3] r.n.h.s.HttpServerOperations --- [08cf17fd, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] New http connection, requesting read
2022-09-02 15:26:36.952 - DEBUG [reactor-http-nio-3] r.n.t.TransportConfig --- [08cf17fd, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Initialized pipeline DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.left.httpTrafficHandler = reactor.netty.http.server.HttpTrafficHandler), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
2022-09-02 15:26:36.955 - DEBUG [reactor-http-nio-3] r.n.h.s.HttpServerOperations --- [08cf17fd, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Increasing pending responses, now 1
2022-09-02 15:26:36.955 - DEBUG [reactor-http-nio-3] r.n.h.s.HttpServer --- [08cf17fd-1, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter#6c90595a
2022-09-02 15:26:36.956 - TRACE [reactor-http-nio-3] o.s.w.s.a.HttpWebHandlerAdapter --- [08cf17fd-2] HTTP GET "/stream", headers={masked}
2022-09-02 15:26:36.962 - DEBUG [reactor-http-nio-3] o.s.w.r.h.SimpleUrlHandlerMapping --- [08cf17fd-2] Mapped to com.edi.pacs.video_stream.FfmpegStreamSocketHandler#7ead1d80
2022-09-02 15:26:36.963 - DEBUG [reactor-http-nio-3] r.n.ReactorNetty --- [08cf17fd-1, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Removed handler: reactor.left.httpTrafficHandler, pipeline: DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
2022-09-02 15:26:36.964 - DEBUG [reactor-http-nio-3] r.n.ReactorNetty --- [08cf17fd-1, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Non Removed handler: reactor.left.accessLogHandler, context: null, pipeline: DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
2022-09-02 15:26:36.964 - DEBUG [reactor-http-nio-3] r.n.ReactorNetty --- [08cf17fd-1, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Non Removed handler: reactor.left.httpMetricsHandler, context: null, pipeline: DefaultChannelPipeline{(reactor.left.httpCodec = io.netty.handler.codec.http.HttpServerCodec), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
2022-09-02 15:26:36.964 - DEBUG [reactor-http-nio-3] i.n.h.c.h.w.WebSocketServerHandshaker --- [id: 0x08cf17fd, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] WebSocket version V13 server handshake
2022-09-02 15:26:36.964 - DEBUG [reactor-http-nio-3] i.n.h.c.h.w.WebSocketServerHandshaker --- WebSocket version 13 server handshake key: BCbwUez1uBWHEcnoIKUeBw==, response: 2L7i3HHoJx/Q9QKFH1IWl7ZYzYg=
2022-09-02 15:26:36.964 - DEBUG [reactor-http-nio-3] i.n.h.c.h.w.WebSocketServerHandshaker --- Requested subprotocol(s) not supported: null
2022-09-02 15:26:36.965 - DEBUG [reactor-http-nio-3] o.s.w.r.s.a.ReactorNettyWebSocketSession --- [08cf17fd-2] Session id "b528e63" for http://localhost:8080/stream
2022-09-02 15:26:36.966 - TRACE [reactor-http-nio-3] o.s.w.r.s.a.ReactorNettyWebSocketSession --- [08cf17fd-2] Sending WebSocket BINARY message (8 bytes)
2022-09-02 15:26:36.966 - TRACE [reactor-http-nio-3] i.n.h.c.h.w.WebSocket08FrameEncoder --- Encoding WebSocket Frame opCode=2 length=8
2022-09-02 15:26:36.966 - TRACE [reactor-http-nio-3] o.s.w.s.a.HttpWebHandlerAdapter --- [08cf17fd-2] Completed 200 OK, headers={}
2022-09-02 15:26:36.967 - TRACE [reactor-http-nio-3] o.s.h.s.r.ReactorHttpHandlerAdapter --- [08cf17fd-1, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Handling completed
2022-09-02 15:26:36.967 - INFO [reactor-http-nio-3] r.F.S.2 --- onSubscribe(SinkManyBestEffort.DirectInner)
2022-09-02 15:26:36.967 - INFO [reactor-http-nio-3] r.F.S.2 --- request(128)
2022-09-02 15:26:36.967 - ERROR [reactor-http-nio-3] r.n.t.ServerTransport --- [08cf17fd-1, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] onUncaughtException(ws{uri=/stream, connection=SimpleConnection{channel=[id: 0x08cf17fd, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815]}})
java.io.IOException: An established connection was aborted by the software in your host machine
at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:46)
at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:389)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:258)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:832)
2022-09-02 15:26:36.968 - TRACE [reactor-http-nio-3] r.n.c.ChannelOperations --- [08cf17fd-1, L:/[0:0:0:0:0:0:0:1]:8080 - R:/[0:0:0:0:0:0:0:1]:54815] Disposing ChannelOperation from a channel
java.lang.Exception: ChannelOperation dispose stack
at reactor.netty.channel.ChannelOperations.dispose(ChannelOperations.java:196)
at reactor.netty.transport.ServerTransport$ChildObserver.onUncaughtException(ServerTransport.java:467)
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:232)
at reactor.netty.channel.FluxReceive.onInboundError(FluxReceive.java:453)
at reactor.netty.channel.ChannelOperations.onInboundError(ChannelOperations.java:488)
at reactor.netty.channel.ChannelOperationsHandler.exceptionCaught(ChannelOperationsHandler.java:126)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281)
at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:273)
at io.netty.channel.DefaultChannelPipeline$HeadContext.exceptionCaught(DefaultChannelPipeline.java:1377)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281)
at io.netty.channel.DefaultChannelPipeline.fireExceptionCaught(DefaultChannelPipeline.java:907)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.handleReadException(AbstractNioByteChannel.java:125)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:177)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:832)
2022-09-02 15:26:36.968 - INFO [reactor-http-nio-3] r.F.S.2 --- cancel()
My assumption is that Chrome doesn't "like" something about the given response from the Spring application and then Google closed the connection.
Next what I'll try is to use Jetty or Undertow as server but if it solves my problem, it won't solve my question - why doesn't it work with Netty.
Fixed the problem. Problem was that some web browsers are "allergic" to subprotocol header being empty.
chrome empty subprotocol header network log
There are two possible solutions for this problem.
First solution, fill the subprotocol value. Done the fix in https://github.com/haraldsegliens/spring-webflux-websocket-jsmpeg-chrome-problem/tree/solution/use-protocol and Chrome now handles the stream correctly.
chrome now works by using subprotocol
Second solution, fix jsmpeg so that it doesn't write subprotocol header with empty value instead it should skip subprotocol header. Done fix in https://github.com/haraldsegliens/spring-webflux-websocket-jsmpeg-chrome-problem/tree/solution/fix-in-jsmpeg
Following pull request that fixes the problem in jsmpeg repository: https://github.com/phoboslab/jsmpeg/pull/143
chrome now works by fixing jsmpeg

Hilla not starting Vite - what am I missing?

I have created a hilla app using this:
npx #vaadin/cli init --hilla --auth hilla-with-auth
Works fine!
Now I am trying to add that to an existing spring boot application, but I am having issues with Vite not starting as it should. No exception. No help in the debug output.
I have added:
relevant files in the root (package.json, vite.config.ts, etc.)
vaadin-featureflags.properties in resources folder
hilla dependencies in pom.xml as well as the build plugin
hill annotations to my application class (#Theme, #PWA) and made it extends SpringBootServletInitializer implements AppShellConfigurator
But even if everything seems to be initialized correctly, Vite does not start. Can anyone guide me in the right direction?
This is the most relevant output log:
2022-06-07 08:04:54.046 DEBUG 4947 --- [restartedMain] c.v.f.s.f.s.FullDependenciesScanner :
List of npm dependencies found in the project:
- #hilla/form 1.0.1 dev.hilla.EndpointController
....
2022-06-07 08:04:54.057 DEBUG 4947 --- [restartedMain] c.v.f.s.f.TaskGeneratePackageJson : writing file /Users/michael/Development/Previsto/previsto-server/target/flow-frontend/package.json.
2022-06-07 08:05:02.102 INFO 4947 --- [restartedMain] o.a.container.JSR356AsyncSupport : JSR 356 Mapping path /vaadinServlet
2022-06-07 08:05:02.176 INFO 4947 --- [restartedMain] c.v.f.s.DefaultDeploymentConfiguration :
Vaadin is running in DEBUG MODE.
When deploying application for production, remember to disable debug features. See more from https://vaadin.com/docs/
The following EXPERIMENTAL features are enabled:
- Use Vite for faster front-end builds
2022-06-07 08:05:02.207 DEBUG 4947 --- [restartedMain] c.v.f.s.c.PushRequestHandler : Using pre-initialized Atmosphere for servlet springServlet
2022-06-07 08:05:02.210 DEBUG 4947 --- [restartedMain] c.v.flow.server.VaadinServletService : Using 'com.vaadin.flow.server.communication.IndexHtmlRequestHandler' in client mode bootstrapping
2022-06-07 08:05:02.212 DEBUG 4947 --- [restartedMain] com.vaadin.flow.server.VaadinService : The application has the following routes:
2022-06-07 08:05:02.956 INFO 4947 --- [restartedMain] c.v.flow.server.frontend.FrontendTools : Project node version 16.10.0 is older than 16.14.0. Using node from /Users/michael/.vaadin.
2022-06-07 08:05:03.404 DEBUG 4947 --- [http-nio-8080-exec-1] c.v.f.s.s.VaadinDefaultRequestCache : Saving request to /
2022-06-07 08:05:03.471 DEBUG 4947 --- [http-nio-8080-exec-2] c.v.b.devserver.AbstractDevServerRunner : Requesting resource from Vite http://localhost:0/login
2022-06-07 08:05:03.486 ERROR 4947 --- [http-nio-8080-exec-2] o.a.c.c.C.[.[.[/].[springServlet] : Servlet.service() for servlet [springServlet] threw exception
java.net.ConnectException: Can't assign requested address (connect failed)
at ...

Vaadin 23 Flow - Spring Boot - Live Reload not working

I recently updated my Vaadin Flow Project to the newest Version 23.0.1.
It all did great, but the LiveReload (detecting Java-FileChanges) doesnt work at all (Its detecting only CSS changes).
I created a new Spring Boot Vaadin 23 Project with Spring-Initializr to check if it's the same problem. I followed the LiveReload Section in the official Vaadin Docs, but it does'nt work at all... :(
My Console shows no errors at all..
Does someone have a similar Problem?
Console Output:
2022-03-21 12:28:33.379 INFO 16300 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
[.....]
2022-03-21 12:28:33.814 INFO 16300 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path ''
2022-03-21 12:28:33.827 INFO 16300 --- [ restartedMain] n.b.p.s.PlatonStartupApplicationListener : Initialize Application
2022-03-21 12:28:33.828 INFO 16300 --- [ restartedMain] n.b.p.s.PlatonStartupApplicationListener : Load global catalog.
2022-03-21 12:28:33.987 INFO 16300 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-03-21 12:28:33.988 INFO 16300 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-03-21 12:28:33.992 INFO 16300 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
2022-03-21 12:28:38.306 INFO 16300 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [build-status] : Compiled.
←[38;5;35m
----------------- Frontend compiled successfully. -----------------
←[0m2022-03-21 12:28:38.313 INFO 16300 --- [onPool-worker-3] c.v.b.devserver.AbstractDevServerRunner : Started Webpack. Time: 9897ms
2022-03-21 12:28:38.382 INFO 16300 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : No issues found.

Spring cloud config server is not reading the properties file in local git repository

I am trying to read the properties file for a micro service in local git repository. Its not adding the file details in the propertySource. it is coming as blank.
Request -
http://localhost:8888/limit-service/default
Response -
{"name":"limit-service","profiles":["default"],"label":null,"version":"91d0b396ff46642fc4efc1ec31e616487f51b10b","state":null,"propertySources":[]}
Name of properties file present in local git repo - limit-service.properties
Below is the config detail of config server -
spring.application.name=spring-cloud-config-server
server.port = 8888
logging.level.org.springframework = trace
spring.cloud.config.server.git.uri=file:///E:/microservice/git-local-repo
Please refer the below log while trying to request for the details -
2020-12-18 15:50:48.508 TRACE 14392 --- [nio-8888-exec-2] .b.c.c.ConfigDataEnvironmentContributors : Processing imports [file:/E:/microservice/git-local-repo/]
2020-12-18 15:50:48.508 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application.properties
2020-12-18 15:50:48.508 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application.xml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application.yml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application.yaml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service.xml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service.yml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service.yaml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.properties
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.xml
2020-12-18 15:50:48.509 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.yml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/application-default.yaml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.properties
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.xml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.yml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.c.ConfigDataLocationResolver : Skipping missing resource file:/E:/microservice/git-local-repo/limit-service-default.yaml
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] .b.c.c.ConfigDataEnvironmentContributors : Nothing imported
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] .b.c.c.ConfigDataEnvironmentContributors : Processed imports for of 1 contributors`enter code here`
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment : Applying config data environment contributions
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment : Adding imported property source 'Config resource 'file [E:\microservice\git-local-repo\limit-service.properties]' via location 'file:/E:/microservice/git-local-repo/''
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment : Setting default profiles: [default]
2020-12-18 15:50:48.510 TRACE 14392 --- [nio-8888-exec-2] o.s.b.c.config.ConfigDataEnvironment : Setting active profiles: [default]
2020-12-18 15:50:48.510 DEBUG 14392 --- [nio-8888-exec-2] o.s.core.env.StandardEnvironment : Activating profiles [default]
2020-12-18 15:50:48.511 TRACE 14392 --- [nio-8888-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository : Testing pattern: E:/microservice/git-local-repo/ with property source: E:\microservice\git-local-repo\limit-service.properties
2020-12-18 15:50:48.511 DEBUG 14392 --- [nio-8888-exec-2] o.s.c.c.s.e.NativeEnvironmentRepository : Not adding property source: E:\microservice\git-local-repo\limit-service.properties
2020-12-18 15:50:48.511 DEBUG 14392 --- [nio-8888-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json;q=0.8', given [text/html, application/xhtml+xml, image/avif, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8] and supported [application/json]
2020-12-18 15:50:48.512 TRACE 14392 --- [nio-8888-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Writing [Environment [name=limit-service, profiles=[default], label=null, propertySources=[], version=91d0b396ff46642fc4efc1ec31e616487f51b10b, state=null]]
2020-12-18 15:50:48.513 TRACE 14392 --- [nio-8888-exec-2] s.w.s.m.m.a.RequestMappingHandlerAdapter : Applying default cacheSeconds=-1
2020-12-18 15:50:48.513 TRACE 14392 --- [nio-8888-exec-2] o.s.web.servlet.DispatcherServlet : No view rendering, null ModelAndView returned.
2020-12-18 15:50:48.513 DEBUG 14392 --- [nio-8888-exec-2] o.s.web.servlet.DispatcherServlet : Completed 200 OK, headers={masked}
2020-12-18 15:50:48.513 TRACE 14392 --- [nio-8888-exec-2] o.s.b.w.s.f.OrderedRequestContextFilter : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade#252c2bfc
With 2.4.1 version it's working fine
In my case
I specified path like below
spring.cloud.config.server.git.uri=F:/me/git-localconfig-repo
this issue you must be facing with Spring boot 2.4.1, I suggest to create new project with Spring boot with stable version and It will work.

Spring Actuator endpoints not found after changing dispatcherServlet url mapping

I've developed my first rest service with Spring Boot and Spring Actuator. I needed to change the servlet mapping to a different one. So my code is the following in a #Configuration class:
#Bean
public DispatcherServlet dispatcherServlet() {
return new DispatcherServlet();
}
#Bean
public ServletRegistrationBean dispatcherRegistration(final DispatcherServlet dispatcherServlet) {
final ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet);
registration.addUrlMappings("/api/*");
return registration;
}
The service endpoint is working fine, as I've excluded basic security from it in application.properties:
security.ignored = **/directdebit/**
The problem is that I can't reach the Actuator endpoints. When I try localhost:8080/api/info I get a 404 Not Found error code and I get an audit event with the following data:
AuditEvent [timestamp=Thu Sep 11 12:12:29 CEST 2014, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={message=Access is denied, type=org.springframework.security.access.AccessDeniedException}]
UPDATE
After removing Spring Security from classpath, I can reach localhost:8080/api/info. So, the problem is related to the security applied to the management endpoints when Spring Security found in classpath.
UPDATE
Still fighting with this. I've restored String Security to the classpath and from stack trace I can see that the mappings are not found:
2014-09-16 11:01:09.011 DEBUG 780 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/mappings']
2014-09-16 11:01:09.011 DEBUG 780 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/api/mappings'; against '/mappings'
2014-09-16 11:01:09.011 DEBUG 780 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/mappings/']
2014-09-16 11:01:09.011 DEBUG 780 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/api/mappings'; against '/mappings/'
2014-09-16 11:01:09.011 DEBUG 780 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/mappings.*']
2014-09-16 11:01:09.012 DEBUG 780 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/api/mappings'; against '/mappings.*'
2014-09-16 11:01:09.012 DEBUG 780 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : No matches found
2014-09-16 11:01:09.012 DEBUG 780 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : Trying to match using Ant [pattern='/**']
2014-09-16 11:01:09.012 DEBUG 780 --- [nio-8080-exec-2] o.s.s.w.u.matcher.AntPathRequestMatcher : Request '/api/mappings' matched by universal pattern '/**'
2014-09-16 11:01:09.012 DEBUG 780 --- [nio-8080-exec-2] o.s.s.web.util.matcher.OrRequestMatcher : matched
It looks like the management endpoints are broken if the servlet context path is not '/'. So the question is how can I make Actuator management endpoints aware of the servlet context path?.
The Actuator endpoints are mapped differently from the DispatcherServlet. You can change the path of the Actuator endpoints with the application property management.contextPath, which is by default '/'. You should be able to access your endpoints with localhost:8080/info for example.

Resources