Jump to content
Divad

Spring4d in Linux

Recommended Posts

hi all
has anyone used the spring4d on Linux in a webserver? it works really well in windows, but the moment I even include the container unit in an app for linux, it fails to start. I get a segmentation fault (in Apache).
thanks

Share this post


Link to post

Hi.

when you say as a daemon, I assume it’s not running as a web server ?

 

Thanks 

Share this post


Link to post

Which version of Linux/ apache are you using? Would you be willing to share an example of code that runs? 
I tried again today and on a web service that runs perfectly, I added the spring. Container to the uses clause and it fails. Not other change made 

 

im at a loss 😞

 

thanks 

Share this post


Link to post
6 hours ago, Divad said:

Which version of Linux/ apache are you using? Would you be willing to share an example of code that runs? 
I tried again today and on a web service that runs perfectly, I added the spring. Container to the uses clause and it fails. Not other change made 

 

im at a loss 😞

 

thanks 

See this example project: https://github.com/joaoduarte19/DMVC-with-Spring4D-DI

 

I use Ubuntu 20.04 and 22.04 to deploy in production. For testing and debugging I use Windows WSL.

Share this post


Link to post

Hi. 
Thanks for that. I have tried to compile it, but it seems to have many errors.. so perhaps there is a different version of spring? I have installed MVC, but still cannot compile.
Where is this sample from? 

thanks

Edited by Aztec

Share this post


Link to post
On 7/21/2023 at 6:13 PM, Aztec said:

Hi. 
Thanks for that. I have tried to compile it, but it seems to have many errors.. so perhaps there is a different version of spring? I have installed MVC, but still cannot compile.
Where is this sample from? 

thanks

You have to use the Spring development branch

Share this post


Link to post

Hi.

Ok, so I downloaded the development branch, and installed it into delphi.

(Removed everything from before)

I then added spring.container to the uses clause of my unit, built and deployed. 

Tried to start apache and get a segmentation fault. Removed the unit from the uses clause, recompiled, and everything works.

 

FYI: Linux is Ubuntu 22.04, running virtualmin. Delphi 11.3 

 

I have no idea what else to try!

 

thanks

Share this post


Link to post

Hi

 

I have tried with both..

my own application that has code (TMS coomponents)

and a simple app that simply does nothing.

Same result

Share this post


Link to post
9 hours ago, Aztec said:

Hi.

Ok, so I downloaded the development branch, and installed it into delphi.

(Removed everything from before)

I then added spring.container to the uses clause of my unit, built and deployed. 

Tried to start apache and get a segmentation fault. Removed the unit from the uses clause, recompiled, and everything works.

 

FYI: Linux is Ubuntu 22.04, running virtualmin. Delphi 11.3 

 

I have no idea what else to try!

 

thanks

Perhaps the problem occurs because you are deploying your application as an Apache module. In my case I don't use apache, I deploy it as a self-contained application running as a Linux service.

The way an Apache module is started is different from a self-contained application. It may be that this is causing a failure in the Spring container.

Share this post


Link to post

Yes it seems to be the case. I created a simple self contained app, and it runs.. Thats a pain!

 

I assume you running your app as a web service?  if so what are you using as an alternative to Apache? We will have many thousands of users, so need something robust.

 

thanks!

 

 

Share this post


Link to post
25 minutes ago, Aztec said:

I assume you running your app as a web service?  if so what are you using as an alternative to Apache? We will have many thousands of users, so need something robust.

I run my web services as self-contained services, so I use Indy as the HTTP server. However, all my webservices are behind a reverse proxy (Nginx), so I can set up load balancing for endpoints with a large flow of requests.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×