Hi Folks,
I have written a wrapper for Catalina that allows it to be deployed as a
"sar" file into Apache's Avalon/Phoenix server application framework.
To some it seems unecessary, but Phoenix can serve multiple server
applications from one JVM. Currently these could include :
JAMES (the mail / news server) plus it's DNS server,
FtpServer (new Apache micro-project that's part of Avalon),
HypersonicSQL (waiting in the wings until the HSQLDB team at Sourceforge
commit some changes).
A SOAP server - publish any API as WSDL (courtesy of Glue, until Axis is
finished).
Jesktop (my desktop layer)
Acme.Serve (another http server)
HTTP Proxy server (part of Avalon as a demo)
Soon we hope to be followed by an EJB container...
Anyway, I am here to list some compromises I had to make when I wrap
Catalina and launch it inside the context of Avalon/Phoenix. I've
simulated the processing of "catalina.sh embedded" which launches the
org.apache.catalina.startup.Embedded class. All bar the shutdown part
of main() has been used as inspiration for the wrapper logic. Problems :
1) Env vars "catalina.home" and "catalina.base" suck (sorry). It
basically means that there can't be more than one instace of catalina
running in the same VM. Yes, ordinarily that would be undesirable, but
we don't place such restrictions on other apps (bind-to-port issues
considered). Is there anyway that CatalinaHome could be an object that
it passed into Embedded's constructor? It then passed around to all
that needs it.
2) Primordial classloader. Some components like StandardEngine assume
they must be loaded from the primordial classloader. That's not the
case for the wrapped Catalina. It's my feeling that that type of thing
contributes to Catalina not being able to find servlet classes (that are
definately visible to the launched catalina). To overcome the issue I
had to put servlet.jar in Phoenix's lib directory. That kinda sucks as
the "sar" is no longer drag and drop installable. I'd hope that was
easy to fix, but it's a bit of a black hole for me to pinpoint the
actual line of code that's wrong.
3) Connection handling. We're proud to say that the connection manager
in Phoenix is stolen from Catalina. We'd like to be able to use that
connection manager to listen on ports and pass sockets to the innards of
Catalina. In so doing it does it's own threadpooling. Would it be
possible for us to be inspired by your HttpConnector and have a
connector that implements Connector and have one that takes Sockets
handed from our ConnectionManager?
Lastly congrats on TC4, it's in all other senses a really excellent bit
of coding. Quality work.
Regards,
- Paul H