B4J Question https (SSL) build standalone

M.SALIM

Member
Compiling the server as standalone, does not run on port ConfigureSSL(443).
The screen flashes and exits.
However, it does run on a normal port (i.e. srvr.Port = ????) without ConfigureSSL(????).

Please advise.

SERVER CODE:
Sub Process_Globals
    Private srvr As Server
End Sub

Sub AppStart (Args() As String)   
    srvr.Initialize("srvr")
    ConfigureSSL(443)
    srvr.LogsFileFolder = File.Combine(File.DirApp, "logs")
    srvr.AddHandler("/demo/*", "DemoHandler", False)
    srvr.Start
    Log("Server started")
    StartMessageLoop
End Sub

Private Sub ConfigureSSL (SslPort As Int)
    Dim ssl As SslConfiguration
    ssl.Initialize
    ssl.SetKeyStorePath(File.DirApp,"jetty.keystore")
    ssl.KeyStorePassword = "123456"
    srvr.SetSslConfiguration(ssl, SslPort)
End Sub
 

M.SALIM

Member
Run it with run_debug.bat and check the logs.
Here is the log:

SLF4J: No SLF4J providers were found.​
SLF4J: Defaulting to no-operation (NOP) logger implementation​
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.​
main._configuressl (java line: -1)​
java.util.ServiceConfigurationError: org.eclipse.jetty.util.security.CredentialProvider: module b4j does not declare `uses`​
at java.base/java.util.ServiceLoader.fail(Unknown Source)​
at java.base/java.util.ServiceLoader.checkCaller(Unknown Source)​
at java.base/java.util.ServiceLoader.<init>(Unknown Source)​
at java.base/java.util.ServiceLoader.load(Unknown Source)​
at b4j/org.eclipse.jetty.util.security.Credential.<clinit>(Unknown Source)​
at b4j/org.eclipse.jetty.util.ssl.SslContextFactory.newPassword(Unknown Source)​
at b4j/org.eclipse.jetty.util.ssl.SslContextFactory.setKeyStorePassword(Unknown Source)​
at b4j/anywheresoftware.b4j.object.ServerWrapper$SslContextFactoryWrapper.setKeyStorePassword(Unknown Source)​
at b4j/b4j.example.main._configuressl(Unknown Source)​
at b4j/b4j.example.main._appstart(Unknown Source)​
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)​
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)​
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)​
at java.base/java.lang.reflect.Method.invoke(Unknown Source)​
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)​
at b4j/anywheresoftware.b4a.BA.raiseEvent(Unknown Source)​
at b4j/b4j.example.main.main(Unknown Source)​
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User

Try your code above with the jServer3 Library first. Then make the necessary changes to get it to work with Jserver4:

 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
CHECK the link Erel provided. The solution is THERE ;-)

I know that the solution is there. I made that comment to @M.SALIM (not for myself) but because in my opinion, it's just common courtesy to "wrap-up" a post like this with a brief description of the specific problem and solution - especially when you have other members trying to help you.
 
Upvote 0

aminoacid

Active Member
Licensed User
Longtime User
You would have found the solution by yourself without need to bother others for it if you just had a look at the thread and try it by yourself

I´m out here

Read the entire thread before you make such comments. I was not looking for the solution. I was trying to help the original poster with the solution. Enough said. I am out of here too.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…