You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Alexander B (Jira)" <ji...@apache.org> on 2024/12/06 13:43:00 UTC
[jira] [Created] (DIRMINA-1185) Question about Unbinding NioAcceptor
Alexander B created DIRMINA-1185:
------------------------------------
Summary: Question about Unbinding NioAcceptor
Key: DIRMINA-1185
URL: https://issues.apache.org/jira/browse/DIRMINA-1185
Project: MINA
Issue Type: Bug
Components: Core
Affects Versions: 2.1.8
Reporter: Alexander B
Hi there,
We have an application (Tomcat7 , Java8), which uses Mina 2.1.8. The intention is to open a port (in this example 2004) and close this connection object in case nobody will be connected. Then after a moment a new binding should be performed on this object.
Until today this Tomcat ran on HTTP. I have switched to HTTPS and actually I did not touch any code, which includes/extends any Mina-classes.
In the first case (Tomcat running on HTTP), there is an instance of NioSocketAcceptor, which will be `unbind()`, if there is no connection after a specific time. Then a reconnect (new bind on port 2004) will be performed and the same port will be opened again. This works fine.
In the second case (Tomcat running on HTTPS with the following changes: I created a keystore, integrated it into the project and adapted tomcat's server.xml) after a specific time I called unbind() on the NioSocketAccepter-object and then a reconnect we will performed again. In this moment, the new binding crashes with the message :
```
java.io.IOException: Error while binding on 0.0.0.0/0.0.0.0:2004
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:301)
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:52)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.registerHandles(AbstractPollingIoAcceptor.java:621)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:518)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:461)
at sun.nio.ch.Net.bind(Net.java:453)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:296)
... 7 common frames omitted
```
Do you know, if there are any issues regarding the unbinding process in Mina in combination with a running Tomcat on HTTPS? Or do I have to change any implementation including mina classes?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org