TomcatExpert

Developers

Ask the Experts : Tomcat 7 and Parallel Deployment

We are trying to deploy 2 versions of the same application on Tomcat 7 to test its parallel deployment features for our application.

Not meeting with success, I was looking for  a definitive guide for parallel deployment on Tomcat 7.

 

Our application is a JSP based application but we can have changes often.

asked by csaoin

question

The definitive reference for parallel deployment comes directly from the Apache Software Foundation: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Parallel_deployment.

Additionally, Mark Thomas wrote a summary article explaining how this feature works on the Context Container and across clusters: http://www.tomcatexpert.com/blog/2011/05/31/parallel-deployment-tomcat-7.

answered by SpringSource on January 6, 2012 07:13 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers, Operations | Parallel Deployment, Tomcat 7, Tomcat Configuration

Ask the Experts : How to configure a single Apache Tomacat 7 instance to serve with multiple domains

Yes, this feature has been available in tomcat for a while.

http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html

You would create multiple <Host> elements

answered by fhanik on January 5, 2012 12:40 PM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers | Tomcat Configuration, Apache Tomcat 7

Blog : Year in Review 2011

posted by Stacey Schneider on January 4, 2012 07:31 AM

2011 has been a great year for the Tomcat Expert community. After almost 2 years of operating, the Tomcat Expert has hit its stride, unloading an array of new information, as well as keeping you up to date with the newest releases for Apache Tomcat 6 and Apache Tomcat 7. With the addition of two new Tomcat Expert Contributors, (Channing Benson and Daniel Mikusa), the Tomcat Expert community continues to build on its reputation for being the leading source for fresh perspectives and new information on how to best leverage Apache Tomcat in the enterprise.

Read More

0 comments   |  

0
Rating
  |  

Developers, Executives | Cross-site Scripting, Java Development, Parallel Deployment

Ask the Experts : Tomcat 7 jdbc pool – Enabling setTestOnBorrow() without setting validationQuery

I enabled setTestonBorrow() without specifying the validation query. I had seen the documentation of the jdbc pool, which mentions about setTestonBorrow() as below:

“NOTE – for a true value to have any effect, the validationQuery parameter must be set to a non-null string.”

I actually tested the application with this setting, and could not find any issue. But in real scenario (since the borrowing of the connection from the pool was in large numbers), the TCP/IP connections between the server and the database peaked.

asked by sivakumarok

question

Given that this is not really a question, but more of an observation followed by a feature request.  I would suggest that you try the following steps.  They should help you to properly log your request.

  1. Pull the latest code from SVN [1], build the jdbc-pool from it and repeat your tests with the code you built.  This will ensure that the issue you are testing has not already been corrected.
  2. If you are still seeing the issue, check Bugzilla [2] to see if anyone else has already reported the issue.
  3. If no one else has reported the issue, open a new bug report. 
  4. If you have the ability, take a look at the code you downloaded in step #1.  Forumlate a patch which resolves your issue.  Attach it to the Bugzilla issue (either one you found in step #2 or one you created in step #3).
  5. If you need additional assistence check the Tomcat users or dev mailing list [3].  Use the proper list depending on the nature of your question.
  6. As a general reference, you can see more information about contributing to Apache Tomcat here [4].

Dan

 

[1] - https://svn.apache.org/repos/asf/tomcat/trunk/modules/jdbc-pool/
[2] - https://issues.apache.org/bugzilla/
[3] - https://tomcat.apache.org/lists.html
[4] - https://tomcat.apache.org/getinvolved.html

answered by dmikusa on May 3, 2012 06:51 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers | setTestonBorrow validationquery

Ask the Experts : Connection get closed after a network sweep

Hi,

I am using tomcat jdbc pool with microsoft (sqljdbc4) driver. The network team runs some network sweep once every week. After this process, the connections get closed. And it does not get connected again. Then we have to restart the servers. Is there a configuration which will help in getting the connection again?

Thanks.

asked by sivakumarok

question

I'm not entirely sure what you mean by a "network sweep".  However, if your database connections are being closed for whatever reason, you need to configure your DataSource to detect the closed connections and evict them from the pool.

One way to do that is by adding the attributes testOnBorrow="true" and validationQuery="SELECT 1" (you might need to adjust the validation query for SQL Server compatibility).

With these options, jdbc-pool will execute the validation query on each connection prior to it's use by your applciation.  If the validation query fails then the connection will be removed from the pool.

For more details, please see the documentation for jdbc-pool.

https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

Dan

answered by dmikusa on January 17, 2012 07:06 AM

Read More

answer

0 comments   |  

0
Rating
  |  

Developers | connectin closed, jdbc connection pool

Blog : Apache Valve Catalog

posted by chanthing on December 21, 2011 05:48 AM

1. Introduction

My last article for Tomcat Expert described various aspects of the Valve construct of Apache Tomcat: some basics about how to implement and configure a valve and an example of where things could go wrong if you were unaware of the operational details. For those of you who don’t remember (or didn’t read the article in the first place), the key takeaway was that because Tomcat valves are maintained as a chain, the order in which the valves are added to the configuration (typically in conf/server.xml) is significant, and the code that implements the filter must conclude with a call to invoke the next filter in the chain.

This time we’re going to lighten things up a bit with a general survey of what valves are available and how one might put them to use. Given the imminent arrival of the winter holiday season, one might think of it as the Apache Tomcat Valve Gift Catalog. Peruse it and find just the right gift for your favorite Tomcat administrator.

For each valve, I’ll describe its functionality, the most important configuration parameters, and point out any configuration subtleties that might not be apparent from the stock documentation. that can be found at http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html. If there are any less well-known attributes or “secret” parameters associated with the valve, I’ll describe them.

 

2. Request Logging

2.1 Access Log Valve

The AccessLogValve can be configured at the context, host, or engine level and will log requests made to that container to a file. Attributes of AccessLogValve control the directory, the filename, and the format of the data to be written, including the ability to write information about headers (incoming and outgoing), cookies, and session or request attributes.

Read More

0 comments   |  

0
Rating
  |  

Developers, Operations | Tomcat Configuration, Tomcat Performance, Tomcat Valves

Blog : Apache Tomcat 6.0.35 Released

posted by Stacey Schneider on December 6, 2011 12:09 PM

The Apache Tomcat team announces the immediate availability of Apache Tomcat 6.0.35 stable.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Apache Tomcat 6.0.35 is primarily a security and bug fix release. All users of older versions of the Tomcat 6.0 family should upgrade to 6.0.35.

Note that is version has 4 zip binaries: a generic one and three bundled with Tomcat native binaries for different CPU architectures.

Read More

2 comments   |  

0
Rating
  |  

Developers, Operations | Apache Tomcat 6

Blog : Apache Tomcat 7.0.23 Release

posted by Stacey Schneider on November 27, 2011 12:08 PM

The Apache Tomcat team announces the immediate availability of Apache Tomcat 7.0.23

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This release includes numerous bug fixes and several new features compared to version 7.0.22. The notable new features include:

  • The ability to start and stop child containers (primarily Contexts: i.e. web applications) in parallel which can significantly improve start times. This is disabled by default but can be enabled by setting the startStopThreads attribute of a Host to a value greater than one.
  • Cache the results of parsing the global and host level context.xml files to improve start times.
  • Improve the handling of failed deployments so that a broken application can be fixed (e.g. via JMX) and another attempt made to start it rather than it having to be removed.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-7.0-doc/changelog.html

Read More

0 comments   |  

0
Rating
  |  

Developers, Operations | Apache Tomcat 7

Blog : Performance Tuning the JVM for Running Apache Tomcat

posted by dmikusa on November 22, 2011 09:13 AM

This article is the second in a series discussing how to performance tune the JVM to better run Apache Tomcat. In the first article, we discussed the basic basic goals and how to monitor the performance of your JVM.

If you have not read the first article, I would strongly suggest reading that before continuing with this article. It is important to understand and follow the processes outlined in that article when performance tuning. They will both save you time and prevent you getting into trouble. With that, let's continue.

Tuning the JVM

At this point we've covered the basics and are ready to begin examining the JVM options that are available to us. Please note that while these options can be used for any application running on the JVM, this article will focus sole only how they can be applied to Tomcat. The usage of these options for other applications may or may not be appropriate.

Note: For simplicity, it is assumed that you are running an Oracle Hotspot JVM.

Read More

4 comments   |  

0
Rating
  |  

Developers, Operations | Tomcat Configuration, Tomcat Performance

Blog : Setting Up Measurement of Garbage Collection in Apache Tomcat

posted by dmikusa on November 16, 2011 08:15 AM

Have you ever seen this scenario before? A user has deployed an application to a Tomcat server. The application works great during testing and QA; however, when the user moves the application into production, the load increases and Tomcat stops handling requests. At first this happens occasionally and for only 5 or 10 seconds per occurrence. It's such a small issue, the user might not even notice or, if noticed, may choose to just ignore the problem. After all, it's only 5 or 10 seconds and it's not happening very often. Unfortunately for the user, as the application continues to run the problem continues to occur and with a greater frequency; possibly until the Tomcat server just stops responding to requests all together.

There is a good chance that at some point in your career, you or someone you know has faced this issue. While there are multiple possible causes to this problem like blocked threads, too much load on the server, or even application specific problems, the one cause of this problem that I see over and over is excessive garbage collection.

As an application runs it creates objects. As it continues to run, many of these objects are no longer needed. In Java, the unused objects remain in memory until a garbage collection occurs and frees up the memory used by the objects. In most cases, these garbage collections run very quickly, but occasionally the garbage collector will need to run a “full” collection. When a full collection is run, not only does it take a considerable amount of time, but the entire JVM has to be paused while the collector runs. It is this “stop-the-world” behavior that causes Tomcat to fail to respond to a request.

Fortunately, there are some strategies which can be employed to mitigate the affects of garbage collections; but first, a quick discussion about performance tuning.

Read More

3 comments   |  

4
Rating
  |  

Developers, Operations | Tomcat Configuration, Tomcat Performance

Syndicate content