B4J Question Auto-restart a JServer Application when app crashes

luc-dev

Member
Licensed User
Hi,

Just wondering how to automatically handle a JServer App crash :

AFAIK B4J Web applications use Jetty as an embedded http server and run in their own process.
In case of application crash all clients are disconnected and unable to use the server.
(a simple error in a sql statement not protected by Try/Catch block can easely crash your server)

On the opposite, script based language (PHP,...) running with an external Web Server will not crash the server in case of error in the script.

To secure a B4J WebServer application, is it possible to use a kind of "WatchDog" to monitor the app is running and to restart it in case of failure?

Thanks ! :)
 

MarkusR

Well-Known Member
Licensed User
i think every error pass here, then u can return false etc and the process will stay alive.
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
 

luc-dev

Member
Licensed User
Hi,

I am running a console app.

I did some more testing on another computer in debug and release mode with two "web" modules, one to test an access violation error or a SQL error and the other with just normal running code.

The second module continues to work even after the first module is called and crashes.

Sorry for my wrong thinking about how the embedded WebServer handles exceptions.

It is a very good point for B4J as it enables to build web apps that need high availability.

As a side though, is it possible to have the errors sent to the server log file?

Thanks
 

Cableguy

Expert
Licensed User
This is a good question, specially if we think about ABMATERIAL webapps, that also rely on jetty, and can be quite complex.
So I'm following this with interest
 
Top