<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6384226714159982549</id><updated>2011-11-27T16:08:50.712-08:00</updated><category term='tomcat axis tutorial'/><category term='tomcat maxThreads configuration'/><category term='tomcat session listener'/><category term='tomcat context listener example'/><category term='tomcat web xml configure'/><title type='text'>tomcat configuration</title><subtitle type='html'>This blog is a friendly place where you can learn about tomcat configuration, tomcat tips and more....</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6384226714159982549.post-4011619940516128472</id><published>2010-11-18T04:19:00.001-08:00</published><updated>2010-11-18T04:41:52.998-08:00</updated><title type='text'>tomcat mod_jk tutorial</title><content type='html'>mod_jk is a replacement to the elderly mod_jserv. It is a plug-in that handles the communication between Tomcat and Apache. &lt;br /&gt;&lt;br /&gt;In this tutorial, we assume that a stable Apache Web Server 2.X has been installed on your host. The next step in the checklist is downloading the latest stable release of Tomcat mod_jk, available at &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/"&gt;http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Once downloaded, the module mod_jk.so should be copied in your Apache module directory (usually located in the APACHE_ROOT/modules directory). Check your Apache documentation if you cannot locate it.&lt;br /&gt;&lt;br /&gt;Windows users are encouraged to rename the binary file to mod_jk.dll if the downloaded Windows module bears the .so extension. This way you will not confuse this library with a compiled library for Unix.&lt;br /&gt;The configuration of mod_jk can be included into the Apache httpd.conf file or held in an external file, which is a good practice:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Load mod_jk module&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;LoadModule jk_module modulesc/mod_jk.so # UNIX&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# LoadModule jk_module modules/mod_jk.dll # WINDOWS&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Where to find workers.properties&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;JkWorkersFile /etc/httpd/conf/workers.properties&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Where to put jk shared memory&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;JkShmFile /var/log/httpd/mod_jk.shm&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Where to put jk logs&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;JkLogFile /var/log/httpd/mod_jk.log&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Set the jk log level [debug/error/info]&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;JkLogLevel info&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Select the timestamp log format&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Send everything for context /yourApplication to mod_jk loadbalancer&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;JkMount /yourApplication/* loadbalancer&lt;/div&gt;&lt;br /&gt;The module is loaded in memory by the LoadModule directive; the configuration of the single nodes is contained in a separate file named workers.properties, which will be examined in a moment.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;JkMount &lt;/b&gt;directive tells Apache which URLs it should forward to the mod_jk module. Supposing we have deployed a web application reachable at the web context yourApplication, with the above JKMount directive all requests with URL path /yourApplication/* are sent to the mod_jk load balancer. This way, you actually split the requests either on Apache directly (static contents) or on the load balancer for Java applications.&lt;br /&gt;&lt;br /&gt;So, if you want your web application served directly by Tomcat Web Server you would need to point the browser to this location: &lt;a href="http://localhost:8080/yourApplication"&gt;http://localhost:8080/yourApplication&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The same web context, proxied by Apache Web server can be reached at: &lt;br /&gt;&lt;a href="http://localhost/yourApplication"&gt;http://localhost/yourApplication&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Additionally, you can use the &lt;b&gt;JkMountFile &lt;/b&gt;directive that allows dynamic updates of mount points at runtime. When the mount file is changed, mod_jk will reload its content.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Load mount points&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;JkMountFile conf/uriworkermap.properties&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;The format of the file is /url=worker_name. To get things started, paste the following example into the file you created:&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Mount the Servlet context to the ajp13 worker&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/yourApplication=loadbalancer&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/yourApplication/*=loadbalancer&lt;/div&gt;&lt;br /&gt;This will configure mod_jk to forward requests to /yourApplication Apache web container.&lt;br /&gt;Next, you need to configure the workers file &lt;b&gt;conf/workers.properties&lt;/b&gt;. A worker is a process that defines a communication link between Apache and the Tomcat container.&lt;br /&gt;&lt;br /&gt;This file specifies where the different nodes are located and how to balance the calls between the hosts. The configuration file is made up of global directives (that are generic for all nodes) and the individual worker's configuration. This is a sample two-node configuration:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Define list of workers that will be used&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.list=loadbalancer,status&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Define Node1&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node1.port=8009&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node1.host=192.168.10.1&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node1.type=ajp13&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node1.lbfactor=1&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node1.cachesize=10&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Define Node2&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node2.port=8009&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node2.host=192.168.10.2&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node2.type=ajp13&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node2.lbfactor=1&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.node2.cachesize=10&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Load-balancing behaviour&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.loadbalancer.type=lb&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.loadbalancer.balance_workers=node1,node2&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.loadbalancer.sticky_session=1&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# Status worker for managing load balancer&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;worker.status.type=status&lt;/div&gt;&lt;br /&gt;In this file, each node is defined using the worker.XXX naming convention where XXX represents an arbitrary name you choose for each of the target servlet containers. For each worker, you must specify the host name (or IP address) and the port number of the AJP13 connector running in the servlet container.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;balance_workers&lt;/b&gt; is a comma-separated list of workers that the load balancer need to manage.&lt;br /&gt;&lt;b&gt;sticky_session&lt;/b&gt; specifies whether requests with SESSION IDs should be routed back to the same Tomcat worker. If sticky_session is set to true or 1, sessions are sticky, otherwise sticky_session is set to false. (The default is true.)&lt;br /&gt;&lt;br /&gt;Finally, we must configure the Web instances on all clustered nodes so that they can expect requests forwarded from the mod_jk load balancer. Edit the server.xml file; locate the &lt;engine&gt; element and add an attribute &lt;b&gt;jvmRoute&lt;/b&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;engine defaulthost="localhost" jvmroute="node1" name="Catalina"&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; &lt;engine defaulthost="localhost" jvmroute="node1" name="Catalina"&gt;&lt;/engine&gt;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ... ...&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/engine&gt;&lt;br /&gt;The same attribute is required on &lt;b&gt;node2&lt;/b&gt;:&lt;/engine&gt;&lt;br /&gt;&lt;engine&gt;&lt;engine defaulthost="localhost" jvmroute="node1" name="Catalina"&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;engine defaulthost="localhost" jvmroute="node2" name="Catalina"&gt;&lt;/engine&gt;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ... ...&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/engine&gt;&lt;/engine&gt;&lt;engine defaulthost="localhost" jvmroute="node2" name="Catalina"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/engine&gt;&lt;br /&gt;You also need to be sure the AJP Connector definition is uncommented. By default, it is enabled.&lt;br /&gt;&lt;engine&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;connector address="${jboss.bind.address}" port="8009" protocol="AJP/1.3"&gt;&lt;/connector&gt;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;emptySessionPath="true" enableLookups="false" redirectPort="8443" /&amp;gt;&lt;/span&gt;&lt;connector address="${jboss.bind.address}" port="8009" protocol="AJP/1.3"&gt;&lt;/connector&gt;&lt;/engine&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6384226714159982549-4011619940516128472?l=tomcat-configure.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/4011619940516128472/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://tomcat-configure.blogspot.com/2010/11/tomcat-modjk-tutorial.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/4011619940516128472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/4011619940516128472'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/2010/11/tomcat-modjk-tutorial.html' title='tomcat mod_jk tutorial'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6384226714159982549.post-1915168922378287800</id><published>2009-03-17T08:38:00.000-07:00</published><updated>2009-03-17T09:18:45.214-07:00</updated><title type='text'>Tomcat pooling</title><content type='html'>With Database Connection Pooling (DBCP), we can scale our applications to handle increased load and deliver high performance benefits. Using recycled database connection objects cuts the time taken to re-instantiate and load frequently used objects, thus reducing unnecessary overheads.&lt;br /&gt;&lt;br /&gt;Our approach to DBCP uses the Jakarta-Commons database connection pool. But first, we need to configure the JNDI DataSource in Tomcat by adding a declaration for the resource to &lt;strong&gt;server.xml file&lt;/strong&gt;, which resides inside the /conf directory of your Tomcat installation (indicated by the environment variable CATALINA_HOME). The JNDI DataSource is used as a factory for connections. One of the major advantages of using a configuration like this is that the characteristics of the pool can be changed without affecting the application code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;server.xml ========================================&lt;/strong&gt;&lt;br /&gt;.........&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&amp;lt;Host &amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;Context path="/edi-web" docBase="edi-web" debug="5"&lt;br /&gt;             reloadable="true" crossContext="true"&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;Resource name="EDI-DS" auth="Container"&lt;br /&gt;           type="javax.sql.DataSource" removeAbandoned="true"&lt;br /&gt;           removeAbandonedTimeout="30" maxActive="100"&lt;br /&gt;           maxIdle="30" maxWait="10000" username="user"&lt;br /&gt;           password="passws"&lt;br /&gt;           driverClassName="oracle.jdbc.driver.OracleDriver"&lt;br /&gt;           url="jdbc:oracle:thin:@192.168.0.1:1521:SME1" /&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;/Context&amp;gt;&lt;br /&gt;      &lt;br /&gt;             &lt;br /&gt;&amp;lt;/Host&amp;gt;&lt;br /&gt;&lt;/pre&gt;=================================================&lt;br /&gt;&lt;br /&gt;In this example we have configured the DataSource EDI-DS which references an Oracle connection.&lt;br /&gt;&lt;br /&gt;Use of the JDBC Data Sources requires that you make an appropriate JDBC driver available to both Tomcat internal classes and to your web application. This is most easily accomplished by installing the driver's JAR file(s) into the $CATALINA_HOME/common/lib directory, which makes the driver available both to the resource factory and to your application&lt;br /&gt;(&lt;strong&gt;Notice:&lt;/strong&gt; &lt;strong&gt;Tomcat 6 library repository is $CATALINA_HOME/lib&lt;/strong&gt; )&lt;br /&gt;&lt;br /&gt;We can configure &lt;strong&gt;a maximum number&lt;/strong&gt; of DB connections in the pool. Make sure you choose a maximum connection count large enough to handle all of your database connections--alternatively, you can set 0 for no limit.&lt;br /&gt;&lt;br /&gt;We can also specify the &lt;strong&gt;maximum time (in milliseconds) to wait&lt;/strong&gt; for a database connection to become available, which in this example is 30 seconds.&lt;br /&gt;&lt;br /&gt;Further, we can set the &lt;strong&gt;maximum number of idle database connections&lt;/strong&gt; to be retained in the pool. Set this value to -1 for no limit. The most optimal performance is attained when the pool in its steady state contains just enough connections to service all concurrent connection requests, without having to create new physical database connections at runtime&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Retrieving the Connection&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Getting a connection form the DataSource is just a matter of looking up the Datasource from the InitialContext and then retrieve the associated connection:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;Context   ctx = new InitialContext();&lt;br /&gt;DataSource ds = (DataSource) ctx.lookup("java:/comp/env/EDI-DS");&lt;br /&gt;Connection conn = ds.getConnection();&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6384226714159982549-1915168922378287800?l=tomcat-configure.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/1915168922378287800/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://tomcat-configure.blogspot.com/2009/03/tomcat-pooling.html#comment-form' title='39 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/1915168922378287800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/1915168922378287800'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/2009/03/tomcat-pooling.html' title='Tomcat pooling'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>39</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6384226714159982549.post-3211952676097437422</id><published>2009-01-20T03:23:00.000-08:00</published><updated>2009-01-21T01:34:18.113-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat axis tutorial'/><title type='text'>Tomcat axis tutorial</title><content type='html'>Axis is essentially a SOAP engine, that is a framework for constructing SOAP processors such as clients, servers, gateways, etc.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Installing Axis on Tomcat&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;At first download Axis from the Apache project:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://ws.apache.org/axis/java/index.html"&gt;http://ws.apache.org/axis/java/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Explode the zip folder. Now you need to deploy the Axis engine to Tomcat: Here's how to do it:&lt;br /&gt;&lt;br /&gt;Rename the folder axis under AXIS_HOME/webapps to &lt;strong&gt;axis.war&lt;/strong&gt; and copy the folder under "webapps" of your tomcat&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Verify that Axis has been deployed correctly:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://localhost:8080/axis/"&gt;http://localhost:8080/axis/&lt;/a&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_YseViSJlkEc/SXbSBPTzB7I/AAAAAAAAAAs/AQapGi6PlDg/s1600-h/axis1.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5293649330751866802" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 300px" alt="" src="http://4.bp.blogspot.com/_YseViSJlkEc/SXbSBPTzB7I/AAAAAAAAAAs/AQapGi6PlDg/s400/axis1.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Publishing Web Services with Axis&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Let's say we have a simple class like the following:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class="code"&gt;&lt;br /&gt;&lt;br /&gt;package test;&lt;br /&gt;&lt;br /&gt;public class HelloWorld {&lt;br /&gt;&lt;br /&gt;  public String hello(String message) {&lt;br /&gt;&lt;br /&gt;    return "Invoked with" +message;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;How do we go about making this class available via SOAP? There are a couple of answers to that &lt;/div&gt;&lt;div&gt;question, but we'll start with an easy solution.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;At first compile the class :&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;javac -d . HelloWorld.java&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now copy the class under WEB-INF/classes of your axis.war&lt;/p&gt;&lt;p&gt;Ok, now the last step is registering your Web Service so that Axis is aware of it. A Web Service can be registered with a &lt;strong&gt;Deployment Descriptor&lt;/strong&gt; (WSDD) file. A deployment descriptor contains a bunch of things you want to "deploy" into Axis - i.e. make available to the Axis engine.&lt;/p&gt;&lt;p&gt;Here's a simple wsdd file for our WebService:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;deployment&lt;br /&gt;xmlns="http://xml.apache.org/axis/wsdd/"&lt;br /&gt;xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;service name="HelloWorld" provider="java:RPC"&amp;gt;&lt;br /&gt;&amp;lt;parameter name="className" value="test.HelloWorld"/&amp;gt;&lt;br /&gt;&amp;lt;parameter name="allowedMethods" value="*"/&amp;gt;&lt;br /&gt;&amp;lt;/service&amp;gt;&lt;br /&gt;&amp;lt;/deployment&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:georgia;"&gt;Pretty simple, really - the outermost element tells the engine that this is a WSDD deployment,&lt;/span&gt;&lt;span style="font-family:georgia;"&gt;and defines the "java" namespace. Then the service element actually defines the service for us. A service is a targeted chain &lt;/span&gt;&lt;span style="font-family:georgia;"&gt;which means it may have any of: a request flow, a provider, and a response flow. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:georgia;"&gt;In this case, our provider is "&lt;strong&gt;java:RPC&lt;/strong&gt;", which is built into Axis, and indicates a Java RPC service. We need to tell the RPCProvider that it should instantiate and call the correct class (e.g. test.HelloWorld), and another to tell the engine that any public method on that class may be called via SOAP (that's what the "*" means)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Now save your wsdd file as deploy.wsdd and run the &lt;strong&gt;AdminClient&lt;/strong&gt; which is an Utility to deploy the WebService&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;java -classpath %AXIS_HOME%/lib/axis.jar;%AXIS_HOME%/lib/commons-discovery-0.2.jar;%AXIS_HOME%/lib/commons-logging-1.0.4.jar;%AXIS_HOME%/lib/saaj.jar;%AXIS_HOME%/lib/jaxrpc.jar &lt;strong&gt;org.apache.axis.client.AdminClient&lt;/strong&gt; deploy.wsdd&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:georgia;"&gt;If everything was Ok now you should see the WebService deployed on Axis: check the "List" option from the URL &lt;a href="http://localhost:8080/axis/"&gt;http://localhost:8080/axis/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:georgia;color:#ff0000;"&gt;&lt;strong&gt;The client&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Let's take a look at an example Web Service client that will call the &lt;strong&gt;hello&lt;/strong&gt; method of the HelloWorld Web Service&lt;br /&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;br /&gt;package test;&lt;br /&gt;&lt;br /&gt;import org.apache.axis.client.Call;&lt;br /&gt;import org.apache.axis.client.Service;&lt;br /&gt;import javax.xml.namespace.QName;&lt;br /&gt;import java.net.URL;&lt;br /&gt;&lt;br /&gt;public class Client {&lt;br /&gt;&lt;br /&gt;  public static void main (String args[]) {&lt;br /&gt;&lt;br /&gt;    try {&lt;br /&gt;&lt;br /&gt;      String url;&lt;br /&gt;&lt;br /&gt;      url="http://localhost:8080/axis/services/HelloWorld";&lt;br /&gt;&lt;br /&gt;      Service service = new Service();&lt;br /&gt;&lt;br /&gt;      Call call = (Call)service.createCall();&lt;br /&gt;&lt;br /&gt;      call.setTargetEndpointAddress(new URL(url));&lt;br /&gt;&lt;br /&gt;      call.setOperationName(new QName("HelloWorld", "hello"));&lt;br /&gt;&lt;br /&gt;      Object[] params = new Object[1];&lt;br /&gt;&lt;br /&gt;      params[0] = "Hello Message";&lt;br /&gt;&lt;br /&gt;      Object result = call.invoke(params);&lt;br /&gt;&lt;br /&gt;      System.out.println("result is " + result);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    catch(Exception e) {&lt;br /&gt;&lt;br /&gt;      e.printStackTrace();&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;In order to invoke our Web Service we use the Service and Call objects. These are the &lt;/div&gt;&lt;div&gt;standard JAX-RPC objects that are used to store metadata about the service to invoke. &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:georgia;"&gt;With this we set up our endpoint URL - this is the destination for our SOAP message.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;call.setTargetEndpointAddress(new URL(url));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:georgia;"&gt;With this we define the operation (method) name of the Web Service.&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:courier new;"&gt;call.setOperationName(new QName("HelloWorld", "hello"));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then we actually invoke the desired service, passing in an array of parameters - in this case just one String. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Object result = call.invoke(params);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Obtaining WSDL for deployed services&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;When you make a service available using Axis, there is typically a unique URL associated with that service. For our service it's &lt;a href="http://localhost:8080/axis/services/HelloWorld?wsdl"&gt;http://localhost:8080/axis/services/HelloWorld?wsdl&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;When you point your browser to that location, Axis will automatically generate a service description for the deployed service, and return it as XML in your browser :&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" ?&amp;gt;&lt;br /&gt;&amp;lt;wsdl:definitions&lt;br /&gt; targetNamespace="http://localhost:8080/axis/services/HelloWorld"&lt;br /&gt; xmlns:apachesoap="http://xml.apache.org/xml-soap"&lt;br /&gt; xmlns:impl="http://localhost:8080/axis/services/HelloWorld"&lt;br /&gt; xmlns:intf="http://localhost:8080/axis/services/HelloWorld"&lt;br /&gt; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&lt;br /&gt; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&lt;br /&gt; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"&lt;br /&gt; xmlns:xsd="http://www.w3.org/2001/XMLSchema"&amp;gt;&lt;br /&gt; &amp;lt;wsdl:message name="helloRequest"&amp;gt;&lt;br /&gt;  &amp;lt;wsdl:part name="in0" type="xsd:string" /&amp;gt;&lt;br /&gt; &amp;lt;/wsdl:message&amp;gt;&lt;br /&gt; &amp;lt;wsdl:message name="helloResponse"&amp;gt;&lt;br /&gt;  &amp;lt;wsdl:part name="helloReturn" type="xsd:string" /&amp;gt;&lt;br /&gt; &amp;lt;/wsdl:message&amp;gt;&lt;br /&gt; &amp;lt;wsdl:portType name="HelloWorld"&amp;gt;&lt;br /&gt;  &amp;lt;wsdl:operation name="hello" parameterOrder="in0"&amp;gt;&lt;br /&gt;   &amp;lt;wsdl:input message="impl:helloRequest" name="helloRequest" /&amp;gt;&lt;br /&gt;   &amp;lt;wsdl:output message="impl:helloResponse"&lt;br /&gt;    name="helloResponse" /&amp;gt;&lt;br /&gt;  &amp;lt;/wsdl:operation&amp;gt;&lt;br /&gt; &amp;lt;/wsdl:portType&amp;gt;&lt;br /&gt; &amp;lt;wsdl:binding name="HelloWorldSoapBinding" type="impl:HelloWorld"&amp;gt;&lt;br /&gt;  &amp;lt;wsdlsoap:binding style="rpc"&lt;br /&gt;   transport="http://schemas.xmlsoap.org/soap/http" /&amp;gt;&lt;br /&gt;  &amp;lt;wsdl:operation name="hello"&amp;gt;&lt;br /&gt;   &amp;lt;wsdlsoap:operation soapAction="" /&amp;gt;&lt;br /&gt;   &amp;lt;wsdl:input name="helloRequest"&amp;gt;&lt;br /&gt;    &amp;lt;wsdlsoap:body&lt;br /&gt;     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&lt;br /&gt;     namespace="http://test" use="encoded" /&amp;gt;&lt;br /&gt;   &amp;lt;/wsdl:input&amp;gt;&lt;br /&gt;   &amp;lt;wsdl:output name="helloResponse"&amp;gt;&lt;br /&gt;    &amp;lt;wsdlsoap:body&lt;br /&gt;     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&lt;br /&gt;     namespace="http://localhost:8080/axis/services/HelloWorld"&lt;br /&gt;     use="encoded" /&amp;gt;&lt;br /&gt;   &amp;lt;/wsdl:output&amp;gt;&lt;br /&gt;  &amp;lt;/wsdl:operation&amp;gt;&lt;br /&gt; &amp;lt;/wsdl:binding&amp;gt;&lt;br /&gt; &amp;lt;wsdl:service name="HelloWorldService"&amp;gt;&lt;br /&gt;  &amp;lt;wsdl:port binding="impl:HelloWorldSoapBinding"&lt;br /&gt;   name="HelloWorld"&amp;gt;&lt;br /&gt;   &amp;lt;wsdlsoap:address&lt;br /&gt;    location="http://localhost:8080/axis/services/HelloWorld" /&amp;gt;&lt;br /&gt;  &amp;lt;/wsdl:port&amp;gt;&lt;br /&gt; &amp;lt;/wsdl:service&amp;gt;&lt;br /&gt;&amp;lt;/wsdl:definitions&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Generating Java Classes from WSDL&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Another approach is to generate Java Classes starting from WSDL contract. You can use the&lt;br /&gt;AdminClient to follow this approach:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;java -classpath %AXIS_HOME%/lib/wsdl4j-1.5.1.jar;%AXIS_HOME%/lib/axis.jar;%AXIS_HOME%/lib/commons-discovery-0.2.jar;%AXIS_HOME%/lib/commons-logging-1.0.4.jar;%AXIS_HOME%/lib/saaj.jar;%AXIS_HOME%/lib/jaxrpc.jar org.apache.axis.wsdl.WSDL2Java &lt;a href="http://localhost:8080/axis/services/HelloWorld?wsdl"&gt;http://localhost:8080/axis/services/HelloWorld?wsdl&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;br /&gt;This will generate the following classes under the service namespace which is localhost\axis\services\HelloWorld&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;HelloWorld.java&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;HelloWorldService.java&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;HelloWorldServiceLocator.java&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;HelloWorldSoapBindingStub.java&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6384226714159982549-3211952676097437422?l=tomcat-configure.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/3211952676097437422/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-axis-tutorial.html#comment-form' title='1 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/3211952676097437422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/3211952676097437422'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-axis-tutorial.html' title='Tomcat axis tutorial'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_YseViSJlkEc/SXbSBPTzB7I/AAAAAAAAAAs/AQapGi6PlDg/s72-c/axis1.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6384226714159982549.post-5800664998651839456</id><published>2009-01-19T05:57:00.000-08:00</published><updated>2009-01-19T06:49:04.545-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat maxThreads configuration'/><title type='text'>Tomcat maxThreads configuration</title><content type='html'>Tomcat &lt;strong&gt;maxThreads&lt;/strong&gt; represents the maximum number of request&lt;br /&gt;processing threads to be created by the HTTPConnector.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&amp;lt;Connector port="8080" address="localhost"     &lt;br /&gt;     maxThreads="250" maxHttpHeaderSize="8192"&lt;br /&gt;     emptySessionPath="true" protocol="HTTP/1.1"&lt;br /&gt;     enableLookups="false" redirectPort="8443" acceptCount="100"&lt;br /&gt;     connectionTimeout="20000" disableUploadTimeout="true" /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;This determines the maximum number of &lt;strong&gt;simultaneous&lt;/strong&gt; requests that can be handled. If not specified, this attribute is set to the default value of 200.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;How the process works:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;At server startup, the HTTP Connector will create a number of processing threads based on the value configured for the &lt;strong&gt;minSpareThreads&lt;/strong&gt; attribute. &lt;/li&gt;&lt;li&gt;Each incoming request requires a thread for the duration of that request. &lt;/li&gt;&lt;li&gt;If the number of simultaneous requests cannot be handled by the currently available request processing threads, additional threads will be created up to the configured maximum (the value of the &lt;strong&gt;maxThreads&lt;/strong&gt; attribute). &lt;/li&gt;&lt;li&gt;If still more simultaneous requests are received, they are stacked up up to the configured maximum (the value of the acceptCount attribute).&lt;/li&gt;&lt;li&gt;Any further simultaneous requests will receive "connection refused" errors, until resources are available to process them.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Guidelines for maxThreads:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;maxThreads&lt;/strong&gt; is an important tuning parameter, however if you are reaching an error like:&lt;/p&gt;&lt;blockquote&gt;&lt;em&gt;org.apache.tomcat.util.threads.ThreadPool logFull SEVERE: All threads (150) are&lt;br /&gt;currently busy, waiting. Increase maxThreads (150) or check the servlet status&lt;/em&gt;&lt;/blockquote&gt;&lt;p&gt;you should at first investigate if it's rather a problem of  individual requests taking too long: are &lt;strong&gt;your threads returning to the pool?&lt;/strong&gt;  if,  for example, database connections are not released,  threads pile up waiting to obtain a database connection thereby making it impossible to process additional requests.  This is a problem in your webapp. &lt;/p&gt;&lt;p&gt;Take a thread dump to find out where they're stuck. Increasing too much &lt;strong&gt;maxThreads&lt;/strong&gt; will lead to :&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Consume a good chunk of memory. &lt;/li&gt;&lt;li&gt;Your system will spend too much time context switching &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;So once you have already optimized your application try raising you maxThread attribute up to 500-750. I wouldn't advice to create larger Connectors, rather if 750 Connections are not enough &lt;strong&gt;create a Cluster configuration&lt;/strong&gt; with several Tomcat instances. For example 2 instances of tomcat each one with maxThreads=500 instead of a single Tomcat with maxThreads=1000&lt;/p&gt;&lt;p&gt;If you want to learn more about JDK tuning read this tutorial which contains many tips valid also for tomcat:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.mastertheboss.com/en/jboss-application-server/113-jboss-performance-tuning-1.html"&gt;http://www.mastertheboss.com/en/jboss-application-server/113-jboss-performance-tuning-1.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6384226714159982549-5800664998651839456?l=tomcat-configure.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/5800664998651839456/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-maxthreads-configuration.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/5800664998651839456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/5800664998651839456'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-maxthreads-configuration.html' title='Tomcat maxThreads configuration'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6384226714159982549.post-8192778256496556057</id><published>2009-01-14T02:41:00.000-08:00</published><updated>2009-01-14T02:52:06.816-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat context listener example'/><title type='text'>Tomcat context listener example</title><content type='html'>When a web application is deployed a servlet context object, &lt;strong&gt;ServletContext&lt;/strong&gt;, is created and associated with the web application. There is a one-to-one relationship between a servlet context object and the web application. &lt;strong&gt;All resources within the web application&lt;/strong&gt;, such as servlets and JSPs, can retrieve any information stored in the servlet context.&lt;br /&gt;');&lt;br /&gt;&lt;br /&gt;As a web application programmer, you may want to initialize objects and place them in the servlet context when it is created and destroy the objects when the servlet context is destroyed.&lt;br /&gt;&lt;br /&gt;For example, you may decide to create a connection to a database when the servlet context is created and close the connection when the servlet context is destroyed.&lt;br /&gt;&lt;br /&gt;To write an application lifecycle event listener that executes when the servlet context is created and destroyed, write a Java class that implements the &lt;strong&gt;javax.Servlet.ServletContextListener&lt;/strong&gt; class.&lt;br /&gt;&lt;br /&gt;This class has two methods with the following signatures (taken from the JavaDocs):&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;void &lt;strong&gt;contextDestroyed&lt;/strong&gt; (ServletContextEvent sce) Notification that the Servlet context is about to be shut down.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;void &lt;strong&gt;contextInitialized&lt;/strong&gt; (ServletContextEvent sce) Notification that the Web Application is ready to process requests&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The Servlet 2.3 specification allows for more interaction between the web application programmer and ServletContext. The programmer can now write an application lifecycle event listener that executes when the attributes of the ServletContext object have been modified. &lt;/p&gt;&lt;p&gt;If you want to execute some code when the attributes of the ServletContext object has been modified, write a Java class that implements the &lt;strong&gt;javax.Servlet.ServletContextAttributesListener&lt;/strong&gt; interface. This interface defines three methods with the following signatures (this is taken from the JavaDocs):&lt;br /&gt;');&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;void &lt;strong&gt;attributeAdded&lt;/strong&gt; (ServletContextAttributeEvent scab) Notification that a new attribute was &lt;em&gt;added&lt;/em&gt; to the servlet context.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;void &lt;strong&gt;attributeRemoved&lt;/strong&gt; (ServletContextAttributeEvent scab) Notification that an existing attribute has been &lt;em&gt;removed&lt;/em&gt; from the servlet context.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;void &lt;strong&gt;attributeReplaced&lt;/strong&gt; (ServletContextAttributeEvent scab) Notification that an attribute on the servlet context has been &lt;em&gt;replaced&lt;/em&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Here's a sample class which implements both ServletContextListener and ServletContextAttributesListener :&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;br /&gt;import javax.servlet.ServletContext;&lt;br /&gt;import javax.servlet.ServletContextAttributeEvent;&lt;br /&gt;import javax.servlet.ServletContextAttributeListener;&lt;br /&gt;import javax.servlet.ServletContextEvent;&lt;br /&gt;import javax.servlet.ServletContextListener;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class ServletContextAttribListener&lt;br /&gt;    implements ServletContextAttributeListener,ServletContextListener  {&lt;br /&gt;&lt;br /&gt;  private ServletContext context = null;&lt;br /&gt;&lt;br /&gt;  //This method is invoked when an attribute&lt;br /&gt;  //is added to the ServletContext object&lt;br /&gt;  public void attributeAdded (ServletContextAttributeEvent scab)&lt;br /&gt;  {&lt;br /&gt;    System.out.println("An attribute was added to the " +&lt;br /&gt;      "ServletContext object");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //This method is invoked when an attribute&lt;br /&gt;  //is removed from the ServletContext object&lt;br /&gt;  public void attributeRemoved (ServletContextAttributeEvent scab)&lt;br /&gt;  {&lt;br /&gt;    System.out.println("An attribute was removed from " +&lt;br /&gt;      "the ServletContext object");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  //This method is invoked when an attribute&lt;br /&gt;  //is replaced in the ServletContext object&lt;br /&gt;  public void attributeReplaced (ServletContextAttributeEvent scab)&lt;br /&gt;  {&lt;br /&gt;    System.out.println("An attribute was replaced in the " +&lt;br /&gt;      "ServletContext object");&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public void contextDestroyed(ServletContextEvent event)&lt;br /&gt;  {&lt;br /&gt;&lt;br /&gt;    //Output a simple message to the server's console&lt;br /&gt;    System.out.println("The Simple Web App. Has Been Removed");&lt;br /&gt;    this.context = null;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  //This method is invoked when the Web Application&lt;br /&gt;  //is ready to service requests&lt;br /&gt;&lt;br /&gt;  public void contextInitialized(ServletContextEvent event)&lt;br /&gt;  {&lt;br /&gt;    this.context = event.getServletContext();&lt;br /&gt;&lt;br /&gt;    //Output a simple message to the server's console&lt;br /&gt;    System.out.println("The Simple Web App. Is Ready");&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6384226714159982549-8192778256496556057?l=tomcat-configure.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/8192778256496556057/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-context-listener-example.html#comment-form' title='1 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/8192778256496556057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/8192778256496556057'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-context-listener-example.html' title='Tomcat context listener example'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6384226714159982549.post-7465757019933340124</id><published>2009-01-13T05:17:00.000-08:00</published><updated>2009-01-14T02:54:17.012-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat session listener'/><title type='text'>Tomcat session listener example</title><content type='html'>As part of Servlet 2.3 specification, we can now make use of session creation and destruction events. Our listener object will be called every time a session is created or destroyed by the server.&lt;br /&gt;&lt;br /&gt;You can use two interfaces as listener for your Session:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;HttpSessionListener&lt;/strong&gt; triggers the listener when a new session is created or destroyed&lt;/li&gt;&lt;li&gt;&lt;strong&gt;HttpSessionBindingListener&lt;/strong&gt; triggers the listener when an Object is bound/unbound from the Session&lt;/li&gt;&lt;/ul&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;HttpSessionListener example:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;package com.sample;&lt;br /&gt;&lt;br /&gt;import javax.servlet.http.HttpSessionListener;&lt;br /&gt;import javax.servlet.http.HttpSessionEvent;&lt;br /&gt;&lt;br /&gt;public class SessionCounter implements HttpSessionListener {&lt;br /&gt;&lt;br /&gt;private static int activeSessions = 0;&lt;br /&gt;&lt;br /&gt; public void sessionCreated(HttpSessionEvent se) {&lt;br /&gt;  activeSessions++;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void sessionDestroyed(HttpSessionEvent se) {&lt;br /&gt;&lt;br /&gt;  if(activeSessions &gt; 0)&lt;br /&gt;   activeSessions--;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public static int getActiveSessions() {&lt;br /&gt;  return activeSessions;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;As you can see, all you have to do is implementing two methods: &lt;strong&gt;sessionCreated&lt;/strong&gt;() method&lt;br /&gt;will be called by the server every time a session is created and &lt;strong&gt;sessionDestroyed&lt;/strong&gt;() method will be called every time a session is invalidated or destroyed.&lt;br /&gt;&lt;br /&gt;In order to activate the listener, you have to configure it in your web.xml&lt;br /&gt;&lt;br /&gt;&amp;lt;listener&amp;gt;&lt;br /&gt;&amp;lt;listener-class&amp;gt;&lt;br /&gt;com.sample.SessionCounter&lt;br /&gt;&amp;lt;/listener-class&amp;gt;&lt;br /&gt;&amp;lt;/listener&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;HttpSessionBindingListener example :&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;import java.sql.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt;&lt;br /&gt;public class JDBCQueryBean implements HttpSessionBindingListener&lt;br /&gt;{&lt;br /&gt;  public void JDBCQueryBean() {   }&lt;br /&gt;&lt;br /&gt;  private Connection conn = null;&lt;br /&gt;&lt;br /&gt;  private void runQuery() {&lt;br /&gt;    StringBuffer sb = new StringBuffer();&lt;br /&gt;    Statement stmt = null;&lt;br /&gt;    ResultSet rset = null;&lt;br /&gt;    try {&lt;br /&gt;      if (conn == null) {&lt;br /&gt;        DriverManager.registerDriver(new .OracleDriver());&lt;br /&gt;        conn = DriverManager.getConnection("jdbc:oracle:oci8:@",&lt;br /&gt;                                           "scott", "tiger");&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;   &lt;br /&gt;      stmt = conn.createStatement();&lt;br /&gt;      rset = stmt.executeQuery ("SELECT * from ....");&lt;br /&gt;  &lt;br /&gt;    } catch (SQLException e) {&lt;br /&gt;       e.printStackTrace();&lt;br /&gt;  }&lt;br /&gt;    finally {&lt;br /&gt;      try {&lt;br /&gt;        if (rset != null) rset.close();&lt;br /&gt;        if (stmt != null) stmt.close();&lt;br /&gt;      }&lt;br /&gt;      catch (SQLException ignored) {}&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void valueBound(HttpSessionBindingEvent event) {&lt;br /&gt;    // do nothing -- the session-scoped bean is already bound&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public synchronized void valueUnbound(HttpSessionBindingEvent event) {&lt;br /&gt;    try {&lt;br /&gt;      if (conn != null) conn.close();&lt;br /&gt;    }&lt;br /&gt;    catch (SQLException ignored) {}&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:Georgia;"&gt;This is a sample code for JDBCQueryBean, a JavaBean that implements the &lt;strong&gt;HttpSessionBindingListener&lt;/strong&gt; &lt;/span&gt;&lt;span style="font-family:Georgia;"&gt;interface. The Connection object is bound into the Session and the &lt;/span&gt;listener takes care to close the connection as soon as the Session expires.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6384226714159982549-7465757019933340124?l=tomcat-configure.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/7465757019933340124/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-session-listener-example.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/7465757019933340124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/7465757019933340124'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-session-listener-example.html' title='Tomcat session listener example'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6384226714159982549.post-357129733391527461</id><published>2009-01-08T07:03:00.000-08:00</published><updated>2009-01-14T02:50:04.461-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat web xml configure'/><title type='text'>Tomcat web xml reference</title><content type='html'>According to the Servlet 2.4 specification, every Web application should include a deployment descriptor (web.xml file). This file must be placed in the WEB-INF/ directory of the Web application.&lt;br /&gt;&lt;br /&gt;There is also a &lt;strong&gt;web.xml&lt;/strong&gt; file under the $CATALINA_HOME/conf directory. This file is similar to a Web application’s web.xml file. However, this particular web.xml file is used to specify the default properties for all Web applications that are running within this server instance.&lt;br /&gt;&lt;br /&gt;Be very careful when making modifications to this file (such as any additions or changes) because they will affect all Web applications running on the same server instance. Note also that other application servers may or may not support a global default web.xml, as this is not a requirement for Servlet 2.4 standard compliance.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Web.xml can be formally validated against a schema:&lt;/p&gt;&amp;lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee"&lt;br /&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;br /&gt;xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"&lt;br /&gt;version="2.4"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a new Servlet mapping ?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;&amp;lt;servlet-name&amp;gt;TestServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;servlet-class&amp;gt;sample.TestServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;servlet-name&amp;gt;TestServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;&amp;lt;url-pattern&amp;gt;/sample&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a parameter to your Context ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;context-param&amp;gt;&lt;br /&gt;&amp;lt;param-name&amp;gt;username&amp;lt;/param-name&amp;gt;&lt;br /&gt;&amp;lt;param-value&amp;gt;frank&amp;lt;/param-value&amp;gt;&lt;br /&gt;&amp;lt;description&amp;gt;parameter description&amp;lt;/description&amp;gt;&lt;br /&gt;&amp;lt;/context-param&amp;gt;&lt;br /&gt;&lt;br /&gt;String username = getServletContext().getInitParameter("username");&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to flag a web application as clusterable ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;distributable/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add an EJB reference in your web.xml ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ejb-ref&amp;gt;&lt;br /&gt;&amp;lt;description&amp;gt;Sample EJB&amp;lt;/description&amp;gt;&lt;br /&gt;&amp;lt;ejb-ref-name&amp;gt;SampleBean&amp;lt;/ejb-ref-name&amp;gt;&lt;br /&gt;&amp;lt;ejb-ref-type&amp;gt;Session&amp;lt;/ejb-ref-type&amp;gt;&lt;br /&gt;&amp;lt;home&amp;gt;com.SampleHome&amp;lt;/home&amp;gt;&lt;br /&gt;&amp;lt;remote&amp;gt;com.Sample&amp;lt;/remote&amp;gt;&lt;br /&gt;&amp;lt;/ejb-ref&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a reference to an environment variable ?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;env-entry&amp;gt;&lt;br /&gt;&amp;lt;env-entry-name&amp;gt;envVar&amp;lt;/env-entry-name&amp;gt;&lt;br /&gt;&amp;lt;env-entry-type&amp;gt;java.lang.Integer&amp;lt;/env-entry-type&amp;gt;&lt;br /&gt;&amp;lt;env-entry-value&amp;gt;15&amp;lt;/env-entry-value&amp;gt;&lt;br /&gt;&amp;lt;/env-entry&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;How to direct errors to error pages ?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;error-page&amp;gt;&lt;br /&gt;&amp;lt;error-code&amp;gt;404&amp;lt;/error-code&amp;gt;&lt;br /&gt;&amp;lt;location&amp;gt;/myApp/jsp/notFound.jsp&amp;lt;/location&amp;gt;&lt;br /&gt;&amp;lt;/error-page&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a filter to your web.xml ?&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;lt;filter&amp;gt;&lt;br /&gt;&amp;lt;filter-name&amp;gt;Compression Filter&amp;lt;/filter-name&amp;gt;&lt;br /&gt;&amp;lt;filter-class&amp;gt;compressionFilters.CompressionFilter&amp;lt;/filter-class&amp;gt;&lt;br /&gt;&amp;lt;init-param&amp;gt;&lt;br /&gt;&amp;lt;param-name&amp;gt;compressionThreshold&amp;lt;/param-name&amp;gt;&lt;br /&gt;&amp;lt;param-value&amp;gt;10&amp;lt;/param-value&amp;gt;&lt;br /&gt;&amp;lt;/init-param&amp;gt;&lt;br /&gt;&amp;lt;/filter&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;filter-mapping&amp;gt;&lt;br /&gt;&amp;lt;filter-name&amp;gt;Compression Filter&amp;lt;/filter-name&amp;gt;&lt;br /&gt;&amp;lt;url-pattern&amp;gt;/CompressionTest&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/filter-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to reference a tag lib ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;jsp-config&amp;gt;&lt;br /&gt;&amp;lt;taglib&amp;gt;&lt;br /&gt;&amp;lt;taglib-uri&amp;gt;http://jakarta.apache.org/tomcat/examples-taglib&amp;lt;/taglib-uri&amp;gt;&lt;br /&gt;&amp;lt;taglib-location&amp;gt;/WEB-INF/jsp/example-taglib.tld&amp;lt;/taglib-location&amp;gt;&lt;br /&gt;&amp;lt;/taglib&amp;gt;&lt;br /&gt;&amp;lt;/jsp-config&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a Context/Session listener ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;listener&amp;gt;&lt;br /&gt;&amp;lt;listener-class&amp;gt;listeners.ContextListener&amp;lt;/listener-class&amp;gt;&lt;br /&gt;&amp;lt;/listener&amp;gt;&lt;br /&gt;&amp;lt;listener&amp;gt;&lt;br /&gt;&amp;lt;listener-class&amp;gt;listeners.SessionListener&amp;lt;/listener-class&amp;gt;&lt;br /&gt;&amp;lt;/listener&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;color:#3366ff;"&gt;Here's an example how to use SessionListeners:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a href="http://tomcat-configure.blogspot.com/2009/01/tomcat-session-listener-example.html"&gt;http://tomcat-configure.blogspot.com/2009/01/tomcat-session-listener-example.html&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;color:#3366ff;"&gt;Here's an example how to use ContextListeners:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a href="http://tomcat-configure.blogspot.com/2009/01/tomcat-context-listener-example.html"&gt;http://tomcat-configure.blogspot.com/2009/01/tomcat-context-listener-example.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to secure your application with JAAS ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;login-config&amp;gt;&lt;br /&gt;&amp;lt;auth-method&amp;gt;FORM&amp;lt;/auth-method&amp;gt;&lt;br /&gt;&amp;lt;realm-name&amp;gt;Example Form-Based Authentication Area&amp;lt;/realm-name&amp;gt;&lt;br /&gt;&amp;lt;form-login-config&amp;gt;&lt;br /&gt;&amp;lt;form-login-page&amp;gt;/security/protected/login.jsp&amp;lt;/form-login-page&amp;gt;&lt;br /&gt;&amp;lt;form-error-page&amp;gt;/security/protected/error.jsp&amp;lt;/form-error-page&amp;gt;&lt;br /&gt;&amp;lt;/form-login-config&amp;gt;&lt;br /&gt;&amp;lt;/login-config&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;&amp;lt;display-name&amp;gt;Example Security Constraint&amp;lt;/display-name&amp;gt;&lt;br /&gt;&amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;&amp;lt;web-resource-name&amp;gt;Protected Area&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;url-pattern&amp;gt;/security/protected/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;http-method&amp;gt;DELETE&amp;lt;/http-method&amp;gt;&lt;br /&gt;&amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;&amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;&amp;lt;http-method&amp;gt;PUT&amp;lt;/http-method&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;&amp;lt;auth-constraint&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;role-name&amp;gt;tomcat&amp;lt;/role-name&amp;gt;&lt;br /&gt;&amp;lt;role-name&amp;gt;role1&amp;lt;/role-name&amp;gt;&lt;br /&gt;&amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;&amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;security-role&amp;gt;&lt;br /&gt;&amp;lt;role-name&amp;gt;role1&amp;lt;/role-name&amp;gt;&lt;br /&gt;&amp;lt;/security-role&amp;gt;&lt;br /&gt;&amp;lt;security-role&amp;gt;&lt;br /&gt;&amp;lt;role-name&amp;gt;tomcat&amp;lt;/role-name&amp;gt;&lt;br /&gt;&amp;lt;/security-role&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a MIME mapping to your web.xml ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mime-mapping&amp;gt;&lt;br /&gt;&amp;lt;extension&amp;gt;pdf&amp;lt;/extension&amp;gt;&lt;br /&gt;&amp;lt;mime-type&amp;gt;application/pdf&amp;lt;/mime-type&amp;gt;&lt;br /&gt;&amp;lt;/mime-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a reference to a Datasource ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- JDBC DataSources (java:comp/env/jdbc) --&amp;gt;&lt;br /&gt;&amp;lt;resource-ref&amp;gt;&lt;br /&gt;&amp;lt;description&amp;gt;The default JDBC datasource&amp;lt;/description&amp;gt;&lt;br /&gt;&amp;lt;res-ref-name&amp;gt;jdbc/DefaultDS&amp;lt;/res-ref-name&amp;gt;&lt;br /&gt;&amp;lt;res-type&amp;gt;javax.sql.DataSource&amp;lt;/res-type&amp;gt;&lt;br /&gt;&amp;lt;res-auth&amp;gt;Container&amp;lt;/res-auth&amp;gt;&lt;br /&gt;&amp;lt;/resource-ref&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to configure the session timeout ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;session-config&amp;gt;&lt;br /&gt;&amp;lt;session-timeout&amp;gt;30&amp;lt;/session-timeout&amp;gt;&lt;br /&gt;&amp;lt;/session-config&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;How to add a welcome file list ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;welcome-file-list&amp;gt;&lt;br /&gt;&amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;welcome-file&amp;gt;&lt;br /&gt;&amp;lt;welcome-file&amp;gt;index.html&amp;lt;welcome-file&amp;gt;&lt;br /&gt;&amp;lt;welcome-file&amp;gt;home.html&amp;lt;welcome-file&amp;gt;&lt;br /&gt;&amp;lt;/welcome-file-list&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6384226714159982549-357129733391527461?l=tomcat-configure.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomcat-configure.blogspot.com/feeds/357129733391527461/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-web-xml.html#comment-form' title='4 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/357129733391527461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6384226714159982549/posts/default/357129733391527461'/><link rel='alternate' type='text/html' href='http://tomcat-configure.blogspot.com/2009/01/tomcat-web-xml.html' title='Tomcat web xml reference'/><author><name>Francesco Marchioni</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry></feed>
