You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple embedded Jetty server work really bad and after short time is a port closed.
All seem be fine, until call curl http://localhost/global/info/.
Then errors appear in the log.
server = new Server(new InetSocketAddress("127.0.0.1", PORT));
/*
//different settings, same behavior
ServerConnector serverConnector = new ServerConnector(server);
serverConnector.setPort(PORT);
serverConnector.setReuseAddress(true);
serverConnector.setReusePort(true);
server.addConnector(serverConnector);
*/
server.addEventListener(new StatusEventListener());
server.setStopAtShutdown(true);
server.setRequestLog(new CustomRequestLog(new Slf4jRequestLogWriter(), CustomRequestLog.NCSA_FORMAT));
ContextHandlerCollection contextCollection = new ContextHandlerCollection();
ResourceHandler staticContext = new ResourceHandler();
staticContext.setBaseResource(ResourceFactory.of(staticContext).newResource(staticDirectory.getAbsolutePath()));
staticContext.setDirAllowed(true);
staticContext.setAcceptRanges(false);
contextCollection.addHandler(new ContextHandler(staticContext, "/static"));
contextCollection.addHandler(new ContextHandler(new InfoHandler(moduleManager),URL_PREFIX+"/global/info"));
server.setHandler(contextCollection);
server.start();
The StatusEventListener just show starting and started event - no fail.
After logging was actived i see exception in the log.
EDIT: After some testing seems that static context (ResourceHandler) is a problem.
WARN AbstractConnector: Accept Failure: java.io.IOException: Socket operation on non-socket
at java.base/sun.nio.ch.Net.accept(Native Method)
at java.base/sun.nio.ch.ServerSocketChannelImpl.implAccept(ServerSocketChannelImpl.java:425)
at java.base/sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:391)
at org.eclipse.jetty.server.ServerConnector.accept(ServerConnector.java:397)
at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:693)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:971)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1196)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1151)
at java.base/java.lang.Thread.run(Thread.java:833)
and/or
WARN AbstractConnector: Accept Failure: java.io.IOException: Invalid argument
at java.base/sun.nio.ch.Net.accept(Native Method)
at java.base/sun.nio.ch.ServerSocketChannelImpl.implAccept(ServerSocketChannelImpl.java:425)
at java.base/sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:391)
at org.eclipse.jetty.server.ServerConnector.accept(ServerConnector.java:397)
at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:693)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:971)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1196)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1151)
at java.base/java.lang.Thread.run(Thread.java:833)
What I do wrong?
thx
The text was updated successfully, but these errors were encountered:
I think this is more either a JVM bug or some incompatibility with the RBPi.
What exact Java vendor are you using?
I would try different ones and see if there is a difference.
I would not use whatever comes with Debian.
Install a suitable version from e.g. https://adoptium.net/
Jetty version(s)
12.0.0 or 12.0.3
Jetty Environment
core
Java version/vendor
openjdk version "17.0.8" 2023-07-18
OS type/version
Linux raspberrypi 6.1.0-rpi4-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64 GNU/Linux
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
Description
Simple embedded Jetty server work really bad and after short time is a port closed.
All seem be fine, until call
curl http://localhost/global/info/
.Then errors appear in the log.
The StatusEventListener just show starting and started event - no fail.
After logging was actived i see exception in the log.
EDIT: After some testing seems that static context (ResourceHandler) is a problem.
and/or
What I do wrong?
thx
The text was updated successfully, but these errors were encountered: