1

I have created 2 apache dll using delphi and this guide:

https://docwiki.embarcadero.com/RADStudio/Sydney/en/DataSnap_REST_Application_Wizard_for_Windows

then I tried installing the first on apache like this:

LoadModule webbroker_module modules/mod_webbroker.dll
<Location /xyz>
  SetHandler mod_webbroker-handler
</Location>

and it works.

When I try to add the second module like this, just below:

LoadModule reportbuilder_module modules/mod_reportbuilder.dll 

<Location /rbbin>
  SetHandler mod_reportbuilder-handler
</Location>

Alias /rbcache/ "C:/Apache24/htdocs/rbbin/rbcache/"
<Directory "C:/Apache24/htdocs/rbbin/rbcache">
  Options All
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

I receive an error from apache saying

only one data module per application

What I would like to achieve is that if I go on port 85 it uses module 1 and if I go on port 86 it uses module 2.

How can I do that?

Thank you

mjn
  • 36,362
  • 28
  • 176
  • 378
lorife
  • 371
  • 1
  • 12
  • Can you post the exact Apache error message? – mjn Feb 10 '23 at 14:50
  • if I start the service from windows services it just terminates. If I start it from msdos I receive this error "only one data module per application" – lorife Feb 10 '23 at 15:48
  • it says 'data module', not only 'module'? Please update the question so it contains the real error message. – mjn Feb 10 '23 at 16:58
  • Maybe related: http://www.delphigroups.info/3/92/55184.html – mjn Feb 10 '23 at 17:00
  • Even with different ports being used, the two DLLs still are loaded in the same Apache process and therefore the error would still appear. – mjn Feb 11 '23 at 08:00

2 Answers2

0

It seems like both DataSnap DLLs call a routine which wants to create a TDataModule. The second call fails with the message 'only one data module per application'.

To verify, you could:

  • remote debug into the DLL startup code.
  • test with one DataSnap DLL and one which is not using DataSnap based.

However, I don't know if it is possible to use two or more DataSnap DLLs in the same Apache process.

mjn
  • 36,362
  • 28
  • 176
  • 378
  • Hello, i can confirm that both projects contains a TDataModule. I use it to keep all my queries organized. I would like to know how to solve it, as they are different project they would be on different ports.isn't there a way to load a module just when using a specific port? Or other solutions? – lorife Feb 10 '23 at 18:30
0

One possible workaround which is easy to test:

  • Run two Apache HTTP server instances (on different ports).

This will keep the DataSnap DLLs separated, one per process.

For access from the "outside world" (Internet), you may use a reverse proxy so all clients can connect using default HTTP(S) ports.

mjn
  • 36,362
  • 28
  • 176
  • 378
  • Hello, something strange happened. I installed a new instance of apache (and a new php). this time 64 bit versions instead of the originals which were 32 bit. I configured again apache and php and this time both modules work on the same new instance. I don't understand, the problem was the 32 bit version? or some misconfiguration in apache? – lorife Feb 14 '23 at 11:32