B4J Question Add other server in ABMaterial app

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I try to put a new server in a ABMaterial APP as following. It is ok when i run it in IDE(release mode).
i try to connect it but it always give me following message when i run its jar in the cmd.

B4X:
java.net.ConnectException: Connection refused: no further information
   at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
   at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
   at org.eclipse.jetty.io.SelectorManager.doFinishConnect(SelectorManager.java:320)
   at org.eclipse.jetty.io.ManagedSelector.processConnect(ManagedSelector.java:350)
   at org.eclipse.jetty.io.ManagedSelector.access$900(ManagedSelector.java:61)
   at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.processSelected(ManagedSelector.java:282)
   at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:177)
   at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:211)
   at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)
   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
   at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
   at java.lang.Thread.run(Thread.java:745)
org.eclipse.jetty.websocket.api.UpgradeException: 0 null
   at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.onComplete(WebSocketUpgradeRequest.java:520)
   at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
   at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
   at org.eclipse.jetty.client.HttpExchange.notifyFailureComplete(HttpExchange.java:269)
   at org.eclipse.jetty.client.HttpExchange.abort(HttpExchange.java:240)
   at org.eclipse.jetty.client.HttpConversation.abort(HttpConversation.java:141)
   at org.eclipse.jetty.client.HttpRequest.abort(HttpRequest.java:748)
   at org.eclipse.jetty.client.HttpDestination.abort(HttpDestination.java:443)
   at org.eclipse.jetty.client.HttpDestination.failed(HttpDestination.java:223)
   at org.eclipse.jetty.client.AbstractConnectionPool$1.failed(AbstractConnectionPool.java:122)
   at org.eclipse.jetty.util.Promise$Wrapper.failed(Promise.java:136)
   at org.eclipse.jetty.client.HttpClient$1$1.failed(HttpClient.java:589)
   at org.eclipse.jetty.client.AbstractHttpClientTransport.connectFailed(AbstractHttpClientTransport.java:154)
   at org.eclipse.jetty.client.AbstractHttpClientTransport$ClientSelectorManager.connectionFailed(AbstractHttpClientTransport.java:199)
   at org.eclipse.jetty.io.ManagedSelector$Connect.failed(ManagedSelector.java:659)
   at org.eclipse.jetty.io.ManagedSelector$Connect.access$1300(ManagedSelector.java:626)
   at org.eclipse.jetty.io.ManagedSelector.processConnect(ManagedSelector.java:380)
   at org.eclipse.jetty.io.ManagedSelector.access$900(ManagedSelector.java:61)
   at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.processSelected(ManagedSelector.java:282)
   at org.eclipse.jetty.io.ManagedSelector$SelectorProducer.produce(ManagedSelector.java:177)
   at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:211)
   at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)
   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
   at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
   at java.lang.Thread.run(Thread.java:745)



B4X:
myApp.AddPage(Report1P.Page)
    myApp.AddPage(VideoP.Page)
    myApp.AddPage(MacroP.Page)
    myApp.AddPage(CodelstP.Page)   
    ' start the server
    myApp.StartServer(srvr, "srvr", 8010)   
    srvr.LogWaitingMessages=False ' 20170928 add
   
    ' start server HTTP/2
    ' myApp.StartServerHTTP2(srvr, "srvr", 51042, 51043, "keystore", "Thunder2000!", "Thunder2000!")
    If db.LogToFile Then       
        ABMShared.RedirectOutput($"${File.DirApp}\logs"$, $"node4-log${jylab.DateNow("yyyyMMdd")}.txt"$)
    End If   
    '
    db.Start
    db.dtlog("Daily Report Start")
    db.ProcessExecute("node4report.jar")
    '
    RunMicro.Initialize
    db.dtlog("******   Program Start   ******")
    '
    srvr1.Initialize("srvr1")
    srvr1.AddWebSocket("/ws/tagwsPage", "tagwsPage")
    srvr1.LogWaitingMessages=False
    srvr1.Port=8011
    srvr1.Start
    db.dtlog("******   p2p Start   ******")
 

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi, I try to add a websocket in the ServerStart(...).
B4X:
srvr.AddFilter("/js/b4j_ws.min.js", "ABMSessionCreator", False)
   srvr.AddWebSocket("/ws/" & ABMShared.AppName, "ABMApplication")
   srvr.AddWebSocket("/ws/tagwsPage","tagwsPage")                             <<-----new one
   For i =0 To Pages.Size - 1
     srvr.AddWebSocket("/ws/" & ABMShared.AppName & "/" & Pages.Get(i) , Pages.Get(i))
     If PageNeedsUpload.Get(i) Then      
       srvr.AddHandler("/" & ABMShared.AppName & "/" & Pages.Get(i) & "/abmuploadhandler", "ABMUploadHandler", False)
     End If
   Next
I can connect tagwsPage in the IDE/release mode
2c5c28dc5cbcc31316027c3bacd605bc.png

I cann't connect it when i run its jar in the cmd too :confused:
 
Upvote 0
Top