B4J Question Multiple JServers only at specific SSL port / without binding at http port

Magma

Expert
Licensed User
Longtime User
Hi there...

Well i am using JServer but i want to have multiple https (only ssl) servers at my vps...

So i have already one running at port 5001 as ssl and i want one more...
but I today I ve seen that not only runs at 5001 (with ssl) but at 8080 (with no security)...

So if I create a 2nd jar - and put it at my Debian server / make my jks / set my ssl port fo example as 5002 - taking a msg:
./jrun
2025-09-30 19:29:27.058:INFO :eek:ejs.Server:main: jetty-11.0.9; built: 2022-03-30T17:44:47.085Z; git: 243a48a658a183130a8c8de353178d154ca04f04; jvm 17.0.16+8-Debian-1deb12u1
main._appstart (java line: 64)
java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080

That because if I check the running PIDs with ss -tulpn - taking that already have a java server runs on:
tcp LISTEN 0 50 *:8080 *:* users("java",pid=2991635,fd=13))
tcp LISTEN 0 50 *:5001 *:* users("java",pid=2991635,fd=14))

* 5001 is my SSL setuped... the other must run somehow automatic from jserver - how to stop running from port 8080 or how to set it at different simple port / extra from ssl ?

I am using the following code:
B4X:
Sub AppStart (Args() As String)
   
   
    If File.Exists(File.Dirapp, "config.ini") Then
        settingsmap = File.ReadMap(File.Dirapp, "config.ini")
    Else
        Log("Error: No config.ini into directory.")
    End If

    If settingsmap.Get("SSL").As(String).Trim.ToLowerCase="false" Then
        srv.Port = settingsmap.Get("Port").As(Int)
    Else
        ConfigureSSL(settingsmap.Get("Port").As(Int)) '5002
    End If


    srv.Initialize("srvr")


    srv.AddHandler("/myactions", "InteractionsHandler",False)

    srv.Start
   
   
    InitializeBot
    StartMessageLoop
    srv.CreateThreadSafeMap
   
End Sub
 
Top