geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: What's missing for Tomcat integration?
Date Fri, 10 Sep 2004 18:41:20 GMT
On Sep 10, 2004, at 11:25 AM, Jeremy Boynes wrote:

> Shapira, Yoav wrote:
>> Hi,
>> After a bit of talking with Geir regarding the 1.0 M2 release still 
>> not
>> supporting Tomcat, I thought I'd jump in and ask: what's missing for
>> Tomcat integration, and how can I help?
> Just getting it running would be a good place to start. That should be 
> a fairly simple GBean that starts an embedded server within Geronimo.

N. Alex sent me a simple version a long time ago.  It simply had an 
unpacked version of tomcat and started it in the same vm a geronimo.  I 
started to work on a closer integration because I really dislike the 
idea of shipping an entire unpacked version of tomcat (since it is 12 
MB), but got busy.  Anyway, the code is at the end of this message (not 
it is very old and may not even compile).


package org.apache.geronimo.tomcat;

import org.apache.catalina.startup.Catalina;
import org.apache.geronimo.gbean.GAttributeInfo;
import org.apache.geronimo.gbean.GBean;
import org.apache.geronimo.gbean.GBeanContext;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
import org.apache.geronimo.gbean.GConstructorInfo;
import org.apache.geronimo.gbean.GReferenceInfo;
import org.apache.geronimo.system.serverinfo.ServerInfo;

public class TomcatService implements GBean {
      * Reference to the org.apache.catalina.startup.Catalina shell
      * Right now we're just wrapping up the shell, but we'll be 
replacing it
      * with our own GBean shell for ease of management.
     private Catalina shell;

      * Reference to the ServerInfo object.  This is recieved through the
      * constructor, and can be used to get information about the 
Server, most
      * notably including the location of the server installation 
      * (and thus the Tomcat base dir).
     private final ServerInfo serverInfo;

     private String catalinaHome;
     private String catalinaBase;

      * Reference to the Catalina shell, to which calls are delegated.
      * The catalina shell relies on the "catalina.home" and 
      * System properties.  Presumably, these could be added in a simple 
      * file, but I'm going to work under the assumption that we'll want 
them as
      * persistent attributes in a server configuration.  This will make 
them more
      * easily manageable (in theory--we'll see)
     public TomcatService(ServerInfo serverInfo, String catalinaHome, 
String catalinaBase) {
         this.serverInfo = serverInfo;
         this.catalinaHome = catalinaHome;
         this.catalinaBase = catalinaBase;

     public void doFail() {

     public void doStart() {
         if (shell == null) {
             shell = new Catalina();

     public void doStop() {
         if (shell != null) {
             shell = null;

     public void setGBeanContext(GBeanContext ctx) {

     public static final GBeanInfo GBEAN_INFO;

     static {
         GBeanInfoFactory infoFactory = new 

         infoFactory.setConstructor(new String[]{"ServerInfo", 
"CatalinaHome", "CatalinaBase"});

         infoFactory.addReference(new GReferenceInfo("ServerInfo", 
         infoFactory.addAttribute("CatalinaHome", String.class, true);
         infoFactory.addAttribute("CatalinaBase", String.class, true);
         GBEAN_INFO = infoFactory.getBeanInfo();

     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;

View raw message