Date: 2004-12-10T16:34:08
   Editor: JacekLaskowski <[EMAIL PROTECTED]>
   Wiki: Apache Geronimo Wiki
   Page: Tomcat
   URL: http://wiki.apache.org/geronimo/Tomcat

   Update

Change Log:

------------------------------------------------------------------------------
@@ -1,111 +1,102 @@
 = About =
 
-!TomcatContainer is a Tomcat service of Apache Geronimo.
+{{{org.apache.geronimo.tomcat.TomcatContainer}}} class is the Tomcat GBean 
(aka service) of Apache Geronimo.
 
-The module started as the ''tomcat'' module in the repository. Currently the 
module contains a simple Tomcat GBean 
(org.apache.geronimo.tomcat.!TomcatContainer class) that's based on Alex 
N.Rupp's ideas.
+The GBean is in the ''tomcat'' module.
 
-As the works on Tomcat integration into Geronimo has just been started it's a 
fantastic way to be involved in Geronimo development. 
[http://nagoya.apache.org/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=10220&sorter/order=DESC&sorter/field=priority&component=11397
 Geronimo JIRA issue tracker] and the page are the primary sources of the 
progress and are to encourage you to be a part of the Geronimo Tomcat module 
team as well as Geronimo itself.
+Check 
[http://nagoya.apache.org/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&pid=10220&sorter/order=DESC&sorter/field=priority&component=11397
 Geronimo JIRA issue tracker] and the page for more information about the 
integration.
 
-Currently the work is being done to create a Tomcat deployer (aka builder) 
based on the jetty-builder module.
+Currently the work is being done to create a complete Tomcat deployer (aka 
builder) based on the jetty-builder module. The very rough yet working deployer 
is already done - !TomcatModuleBuilder.
 
 The version of Apache Tomcat is 5.5.4.
 
 = How to run Tomcat GBean =
 
-Go to ''tomcat'' module and type ''maven''.
-
-Once the build completes, Apache Tomcat can be started via the following 
command (see ["Running"] for more information on how to start Geronimo):
+By default, Geronimo is set up with Jetty as a web container. To enable Apache 
Tomcat, it's necessary to uncomment the sections marked
 
  {{{
-java -Djava.endorsed.dirs=c:\apps\jakarta-tomcat\common\endorsed -jar 
bin/server.jar org/apache/geronimo/Tomcat
+<!-- the tomcat module's requirement
+   - uncomment it to run Apache Tomcat as a web container
+   -
+...
+   -->
 }}}
 
-'''NOTE''': ''java.endorsed.dirs'' Java property must be specified on the 
command line as otherwise Tomcat won't be able to find Xerces classes and 
refuses to deploy web applications. So, before running a Tomcat instance within 
Geronimo the compat libraries of Tomcat (jakarta-tomcat-compat-5.5.4.*) will 
have to be installed. Does anyone know how to work it out?
+The files to be changed are:
 
-'''NOTE''': Geronimo creates empty ''var/catalina/webapps'' directory so 
Tomcat won't find any web application to deploy. As a good starting point copy 
$CATALINA_HOME/webapps/ROOT webapp into that directory.
+ * modules/assembly/project.xml
+ * modules/assembly/src/plan/j2ee-deployer-plan.xml
+ * modules/assembly/src/plan/j2ee-server-plan.xml
 
-'''NOTE''': The Tomcat module is not built in the Geronimo build process. Go 
to {{{modules/tomcat}}} and run {{{maven build}}}.
+Don't forget to change the ''port'' attribute value of 
"geronimo.server:type=WebConnector,container=Jetty,port=8080" from 8080 to 
another value (e.g. 8090) as the port number is hardcoded in !TomcatContainer 
(it's the default listen port of the HTTP connector).
 
-When started (with the ROOT webapp deployed), Geronimo prints out the 
following on the console:
+Once it's done, rebuild the assembly module and start up Geronimo as follows 
(see ["Running"]):
 
  {{{
-$ java -Djava.endorsed.dirs=c\:/apps/jakarta-tomcat/common/endorsed -jar 
bin/server.jar org/apache/geronimo/Tomcat
-11:31:39,892 INFO  [Daemon] Server startup begun
-11:31:39,972 INFO  [Kernel] Starting boot
-11:31:40,213 INFO  [Kernel] Booted
-11:31:40,233 INFO  [ConfigurationManagerImpl] Loaded Configuration 
geronimo.config:name="org/apache/geronimo/System"
-11:31:40,364 INFO  [Configuration] Started configuration 
org/apache/geronimo/System
-11:31:40,494 INFO  [RMIRegistryService] Started RMI Registry on port 1099
-11:31:40,534 INFO  [ReadOnlyRepository] Repository root is 
file:/C:/projs/geronimo/modules/assembly/target/geronimo-1.0-SNAPSHOT/repository/
-11:31:40,625 INFO  [ConfigurationManagerImpl] Loaded Configuration 
geronimo.config:name="org/apache/geronimo/Tomcat"
-11:31:40,675 INFO  [Configuration] Started configuration 
org/apache/geronimo/Tomcat
-11:31:40,725 INFO  [Embedded] Catalina naming disabled
-11:31:41,247 INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-8080
-11:31:41,247 INFO  [Catalina] Initialization processed in 472 ms
-11:31:41,247 INFO  [StandardService] Starting service Catalina
-11:31:41,257 INFO  [StandardEngine] Starting Servlet Engine: Apache 
Tomcat/5.5.4
-11:31:41,267 INFO  [StandardHost] XML validation disabled
-11:31:41,498 INFO  [WebappLoader] Dual registration of jndi stream handler: 
factory already defined
-11:31:42,090 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-8080
-11:31:42,100 INFO  [Catalina] Server startup in 853 ms
-11:31:42,100 INFO  [Daemon] Server startup completed
+java -Djava.endorsed.dirs=c:\apps\jakarta-tomcat\common\endorsed -jar 
bin/server.jar <deployed_webapp_id>
 }}}
 
-It's assumed in the above console output that the ROOT application was 
installed as described in the 2nd note above.
+'''NOTE''': {{{TODO}}}: Describe what's the ''deployed_webapp_id'' identifier
 
-The gbean's plan (aka configuration) is located in 
''modules/tomcat/src/plan/tomcat-plan.xml''. That's where the 
''CATALINA_HOME'', ''CATALINA_BASE'' and ''CATALINA_CONFIG'' variables are set. 
Theoretically, it should also be possible to set them up via java environment 
variables (using -D option).
+'''NOTE''': ''java.endorsed.dirs'' Java property must be specified on the 
command line as otherwise Tomcat won't be able to find Xerces classes and 
refuses to deploy web applications. So, before running a Tomcat instance within 
Geronimo the compat libraries of Tomcat (jakarta-tomcat-compat-5.5.4.*) will 
have to be installed. Does anyone know how to work it out?
 
-The configuration file of the embedded Catalina instance is 
''<geronimo.home>/var/catalina/conf/server.xml''.
+'''NOTE''': CATALINA_HOME environment variable is required to run Tomcat. It's 
set to ''var/catalina/'' (it's not yet possible to change it without touching 
the code)
 
-You may find that Catalina does really start up looking at 
''<geronimo.home>/var/log/geronimo.log'' as well as opening 
http://localhost:8080 (when the ROOT webapp is deployed, it will be brought up).
+'''NOTE''': Default HTTP connector listens to 8080 port (it's not yet possible 
to change it without touching the code)
 
-= Installing Geronimo over one already installed Tomcat =
+'''NOTE''': It's not yet possible to configure Tomcat other than it's done by 
default. All configuration settings are currently hardcoded.
 
-Here's an excerpt of a thread at the Geronimo user mailing list about it:
+A simple start-up of Geronimo with Apache Tomcat and the DebugConsole webapp:
 
  {{{
-On to the question of 'installing Geronimo over one already installed Tomcat' 
-I think it's a matter of specifing correct values CATALINA_HOME, CATALINA_BASE 
and CATALINA_CONFIG in tomcat-plan.xml. 
-It should work fine. That indeed gives only a possibility to run both in the 
same JVM, but keep in mind that that's it. 
-No other integration exists yet (no single security layer, no transactions, no 
common deployment, etc.)
+$ java -Djava.endorsed.dirs=c\:/apps/jakarta-tomcat/common/endorsed -jar 
bin/server.jar org/apache/geronimo/DebugConsole
+01:26:54,015 INFO  [Daemon] Server startup begun
+01:26:54,095 INFO  [Kernel] Starting boot
+01:26:54,355 INFO  [Kernel] Booted
+01:26:54,376 INFO  [ConfigurationManagerImpl] Loaded Configuration 
geronimo.config:name="org/apache/geronimo/System"
+01:26:54,486 INFO  [Configuration] Started configuration 
org/apache/geronimo/System
+01:26:54,616 INFO  [RMIRegistryService] Started RMI Registry on port 1099
+01:26:54,686 INFO  [ReadOnlyRepository] Repository root is 
file:/C:/projs/geronimo/modules/assembly/target/geronimo-1.0-SNAPSHOT/repository/
+01:26:54,746 INFO  [ConfigurationManagerImpl] Loaded Configuration 
geronimo.config:name="org/apache/geronimo/DebugConsole"
+01:26:54,766 INFO  [ConfigurationManagerImpl] Loaded Configuration 
geronimo.config:name="org/apache/geronimo/Server"
+01:26:55,297 INFO  [Configuration] Started configuration 
org/apache/geronimo/Server
+01:26:55,327 INFO  [HttpServer] Statistics on = false for [EMAIL PROTECTED]
+01:26:55,327 INFO  [HttpServer] Version Jetty/5.1.1
+01:26:55,327 INFO  [Container] Started [EMAIL PROTECTED]
+01:26:55,367 INFO  [HOWLLog] Initiating transaction manager recovery
+01:26:55,437 WARN  [HOWLLog] Received unexpected log record: [EMAIL PROTECTED]
+01:26:55,437 INFO  [HOWLLog] In doubt transactions recovered from log
+01:26:55,537 INFO  [ThreadPool] Thread pool DefaultThreadPool started
+01:26:55,567 INFO  [SocketListener] Started SocketListener on 0.0.0.0:8090
+01:26:55,967 INFO  [Embedded] Starting tomcat server
+01:26:55,967 INFO  [Embedded] Catalina naming disabled
+01:26:56,188 INFO  [StandardEngine] Starting Servlet Engine: Apache 
Tomcat/5.5.4
+01:26:56,198 INFO  [StandardHost] XML validation disabled
+01:26:56,308 INFO  [WebappLoader] Dual registration of jndi stream handler: 
factory already defined
+01:26:56,808 INFO  [ContextConfig] Missing application web.xml, using defaults 
only StandardEngine[tomcat.engine].StandardHost[localhost].StandardContext[]
+01:26:57,049 INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-8080
+01:26:57,109 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-8080
+01:26:57,339 INFO  [GeronimoLoginConfiguration] Added ACE JMX
+01:26:57,339 INFO  [GeronimoLoginConfiguration] Added ACE 
geronimo-properties-realm
+01:26:57,349 INFO  [GeronimoLoginConfiguration] Installed Geronimo login 
configuration
+01:26:57,439 INFO  [server:name=localhost,role=JMXService] Started 
JMXConnector service:jmx:rmi://localhost/jndi/rmi:/JMXConnector
+01:26:57,459 INFO  [SecurityService] Security service started
+01:26:57,669 INFO  [Configuration] Started configuration 
org/apache/geronimo/DebugConsole
+01:26:58,360 INFO  [TomcatWebAppContext] TomcatWebAppContext started
+01:26:58,360 INFO  [Daemon] Server startup completed
 }}}
 
-= Problems? =
-
-== java.io.IOException: java.lang.NullPointerException while deploying web 
application ==
-
-The issue hasn't showed up for a while so it seems that it may have been 
worked out.
+= Installing Geronimo over one already installed Tomcat (not possible; 
outdated) =
 
- {{{
-10:18:54,039 ERROR [HostConfig] Error deploying web application directory ROOT
-java.io.IOException: java.lang.NullPointerException
-        at 
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:283)
-        at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
-        at 
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
-        at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
-        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
-        at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
-        at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
-        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
-        at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
-        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
-        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
-        at 
org.apache.catalina.core.StandardService.start(StandardService.java:480)
-        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
-        at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
-        at org.apache.geronimo.tomcat.TomcatGBean.doStart(TomcatGBean.java:101)
-        at 
org.apache.geronimo.gbean.jmx.GBeanMBean.doStart(GBeanMBean.java:593)
-}}}
-
-'''Solution''': Tomcat expects the ''web-jsptaglibrary_2_0.xsd'' file located 
at ''javax/servlet/resources/web-jsptaglibrary_2_0.xsd'', but Geronimo has 
(actually had) the file located at 
''javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd'' in 
''geronimo-spec-j2ee-1.4-rc2.jar'' installed (during the build) into 
''${maven.repo.local}/repository/geronimo-spec/jars''.
-
-To get rid of the issue, rebuild specs/jsp and assembly modules.
+Here's an excerpt of a thread at the Geronimo user mailing list about it:
 
  {{{
-$ maven -o -Dmodule.types=specs -Dmodules=jsp,j2ee rebuild
-$ maven -o -Dmodule.types=modules -Dmodules=assembly,tomcat rebuild
+On to the question of 'installing Geronimo over one already installed Tomcat' 
+I think it's a matter of specifing correct values CATALINA_HOME, CATALINA_BASE 
and CATALINA_CONFIG in tomcat-plan.xml. 
+It should work fine. That indeed gives only a possibility to run both in the 
same JVM, but keep in mind that that's it. 
+No other integration exists yet (no single security layer, no transactions, no 
common deployment, etc.)
 }}}
 
-Note the ''-o'' parameter. It's to tell the build process to not get the jars 
from the public Maven repository (at iBiblio). Also, don't change the 
parameters' value and the order of the commands.
+= A few words on how it works =
 
-'''Note''': Doing rebuild sweeps out your changes to Geronimo installation 
(i.e. modules/assembly/target directory is removed), so don't be surprised when 
no web apps are deployed unless you copied the webapp(s) ''again''.
+The heart of the module is the GBean itself, which is 
org.apache.geronimo.tomcat.!TomcatContainer. TomcatContainer is given a set of 
deployed webapps that are of org.apache.geronimo.tomcat.!TomcatWebAppContext 
type. When a webapp is deployed, a configured !WebModule (aka !WebBuilder) is 
asked for handling it. There're two !WebModules: !JettyModuleBuilder and 
!TomcatModuleBuilder. No matter what builder is used, the idea of deploying the 
webapp is the same. First, !TomcatModuleBuilder creates a plan (wraps it into 
!TomcatWebAppContext) and saves it in the repository (a place where 
configurations are stored). !TomcatWebAppContext's plan contains a reference to 
!TomcatContainer so that when the context starts up it hands itself over to 
!TomcatContainer for deployment.

Reply via email to