You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sankaranarayanan Ganapathy <sg...@vitria.com> on 2002/03/07 21:23:15 UTC

Making Embedded tomcat work off tomcat config files

Hi All,

I am embedding tomcat in my application , but I dont want to deal with
the configuration aspects of tomcat. I see that embedded tomcat requires
that we set the configuration information programatically (like ports,
connectors, contexts) etc. Is there a way to make an embedded tomcat
read this information from the configuration files! 

Alos that the org.apache.catalina.startup.Catalina uses a SAX parser and
adds actions and builds a object hierarchy . Alternatively Is there a
single tomcat api that we could call to build this object hierarchy?

Any help will be greatly appreciated !

Thanx in advance
Ganesh

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Making Embedded tomcat work off tomcat config files

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 7 Mar 2002, Sankaranarayanan Ganapathy wrote:

> Date: Thu, 7 Mar 2002 12:23:15 -0800
> From: Sankaranarayanan Ganapathy <sg...@vitria.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Making Embedded tomcat work off tomcat config files
>
> Hi All,
>
> I am embedding tomcat in my application , but I dont want to deal with
> the configuration aspects of tomcat. I see that embedded tomcat requires
> that we set the configuration information programatically (like ports,
> connectors, contexts) etc. Is there a way to make an embedded tomcat
> read this information from the configuration files!
>

Simplest thing would be to call the main() method of
org.apache.catalina.startup.Bootstrap yourself -- that's all that the
catalina.sh/catalina.bat scripts do.  It will then parse server.xml and
create the hierarchy.

> Alos that the org.apache.catalina.startup.Catalina uses a SAX parser and
> adds actions and builds a object hierarchy . Alternatively Is there a
> single tomcat api that we could call to build this object hierarchy?
>

That's what the Embedded class is for, but you said you didn't want to
deal with the configuration complexity yourself.  Tomcat's standard
approach is to do an XML parse of $CATALINA_HOME/conf/server.xml and
create the corresponding Catalina components in response to interesting
SAX events.  Without reading server.xml, it's up to you to build the
object hierarchy yourself, which Embedded can help you with.

Note that you're going to need an XML parser anyway, because it's used for
reading web.xml files, tag library descriptors, and JSP pages in XML
syntax.

> Any help will be greatly appreciated !
>
> Thanx in advance
> Ganesh
>

Craig


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>