phax / as2-lib

A generic Java AS2 library, servlet and server
107 stars 43 forks source link

AS2 server start doesn't return error (if port is busy) #107

Closed avnerw1 closed 3 years ago

avnerw1 commented 4 years ago

Hi Phillip,

When starting the AS2 server and port is busy, the startActiveModules doesn't throw any exception if port is busy or any other issue. Since it is void, we can't know there is a problem. In addition, the active module status is "running".

Regards, Avner

phax commented 4 years ago

You are referring to the "Socket server" in the as2-server project - right?

avnerw1 commented 4 years ago

Yes, I refer to Socket server

phax commented 4 years ago

Testing it locally, gave me this exception:

com.helger.as2lib.exception.AS2Exception: java.net.BindException: Address already in use: JVM_Bind
    at com.helger.as2.cmdprocessor.SocketCommandProcessor.initDynamicComponent(SocketCommandProcessor.java:136) ~[classes/:?]
    at com.helger.as2lib.util.AS2XMLHelper.createComponent(AS2XMLHelper.java:190) ~[classes/:?]
    at com.helger.as2.app.session.AS2ServerXMLSession.loadCommandProcessor(AS2ServerXMLSession.java:146) ~[classes/:?]
    at com.helger.as2.app.session.AS2ServerXMLSession.loadCommandProcessors(AS2ServerXMLSession.java:140) ~[classes/:?]
    at com.helger.as2.app.session.AS2ServerXMLSession.load(AS2ServerXMLSession.java:215) ~[classes/:?]
    at com.helger.as2.app.session.AS2ServerXMLSession.<init>(AS2ServerXMLSession.java:94) ~[classes/:?]
    at com.helger.as2.app.session.AS2ServerXMLSession.<init>(AS2ServerXMLSession.java:88) ~[classes/:?]
    at com.helger.as2.app.MainOpenAS2Server.start(MainOpenAS2Server.java:82) [classes/:?]
    at com.helger.as2.app.MainRunTestAS2Server.main(MainRunTestAS2Server.java:7) [test-classes/:?]
Caused by: java.net.BindException: Address already in use: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method) ~[?:1.8.0_242]
    at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106) ~[?:1.8.0_242]
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) ~[?:1.8.0_242]
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190) ~[?:1.8.0_242]
    at java.net.ServerSocket.bind(ServerSocket.java:390) ~[?:1.8.0_242]
    at java.net.ServerSocket.<init>(ServerSocket.java:252) ~[?:1.8.0_242]
    at java.net.ServerSocket.<init>(ServerSocket.java:196) ~[?:1.8.0_242]
    at javax.net.ssl.SSLServerSocket.<init>(SSLServerSocket.java:136) ~[?:1.8.0_242]
    at sun.security.ssl.SSLServerSocketImpl.<init>(SSLServerSocketImpl.java:113) ~[?:1.8.0_242]
    at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(SSLServerSocketFactoryImpl.java:79) ~[?:1.8.0_242]
    at com.helger.as2.cmdprocessor.SocketCommandProcessor.initDynamicComponent(SocketCommandProcessor.java:129) ~[classes/:?]