How to setup bajie server for Apache and IIS (ajp version 0.02)



Thanks to Sebastian Thomschke for the updated ajp dll link.

For apache: download mod_jk2-2.0.43.dll (or mod_jk2.so depend on your system) from http://apache.roweboat.net/jakarta/tomcat-connectors/jk2/binaries/ unzip and put the dll in ${apacheHome}/modules directory, where apacheHome is the place you install apache at.
Add the line LoadModule jk2_module modules/mod_jk2-2.0.43.dll in your ${apacheHome}/conf/httpd.conf file.

Restart apache (that is all for apache), start bajie server using ajp.bat. If you didn't remove the bajie server on port 80, you might see a exception about binding port, but that is OK.

For IIS: download isapi_redirector2.dll from same place. You also need to download libapr.dll (download apache server and you will find it in the bin directory). put libapr.dll in the same directory of isapi_redirector2.dll. Put the lines below in a file called temp.reg:
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\2.0]
"serverRoot"="d:\\temp"
"extensionUri"="/jakarta/isapi_redirector2.dll"
"workersFile"="d:\\httpsrv\\workers2.properties"
"authComplete"="0"
"threadPool"="5"
Note here you need to let "workersFile" point to the actual workers2.properties. You can find a sample workers2.properties in bajieserver. Just point to the full path of that file. Now save it as temp.reg and double click on it, windows will ask you if you want to put the values in registry, just click yes.
Now open IIS console. Right Click on DefaultWebSite->properties, and the tab 'ISAPI Filters' Add a new filter, with any name you want and point the executable to isapi_redirector2.dll. Click OK, close the window and come back, make sure the dll is loaded. Now right click on 'Default Website' again, and add a new virtual directory. The name of the directory must be jakarta and the path must be the directory where the isapi_redirector2.dll is stored. Make sure the directory has execution right.


You can also download the httpsrv.95zvr6Ajp.zip, which has the sample workers2.properties.
Start either apache and IIS, then start the server with ajp.bat (on unix you need to edit it, use : instead of ; as path seperator. You should be OK at this point.
Note that the current ajp connector is set to accept from 127.0.0.1 only, this is for security reasons. If you want to change that, change AcceptedHost=xxx.xxx.xxx.xxx in config/ajp.properties to your host address (the ip address where apache will redirect requests).



Make sure you start apache or IIS first. The bajie server starts on port 80 by default, so if you start bajie first, IIS and apache won't be able to start unless you remove the server at 80.
(with ajp, the default server can be removed). You might see an exception rised telling you that bajie server can't start because of port bind failure, that is ok.
Use the ajp.bat to start bajie as a addon engine.

Possible pitfalls


Make sure you have libapr.dll with your isapi_redirector2.dll for IIS. No one mentions that dependency, because most people developed the connector also have apache. Sorry can't put it out there, I am tight on webspace.

During my development, I got a bad IIS server. It servers asp pages ok but calls the redirector from 2 different process!! (calls the filter from one process and extensionProc from another process....). I can't fix that so I reinstalled it, and it won't even server asp pages any more, all I got is something like it can't sign on as IWAM. I had to reinstall windows XP to fix it. So if you got the same problem and find a solution, please let me know, else format harddrive

All other stuff is much easier. Don't try to remove the first entry (aobut shm) form workers2.properties file. On the jakarta website they claim that shm entry is optional, it took me a lot of printfs to find out that is why it won't do its work.
Anyway, enjoy.