Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Configuring Tomcat  RSS feed

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I am in process of developing a site. And i have to upload it, or rather host it. So, what all things i need to configure in tomcat? My application consist of servlets, and jsp.
I have also used connection pooling.
 
Tim Holloway
Bartender
Posts: 18548
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to provide 2 objects. A WAR and a deployment descriptor.

By definition, all J2EE webapps must be in WAR format, although Tomcat does support "exploded" WARs, which are what you get when you unzip a WAR file.

There are actually 2 deployment descriptors. One is server-independent. It's the much-beloved WEB-INF/web.xml file in the WAR. The other is the server-dependent deployment descriptor, which is where the non-portable stuff lives that relates to the particular brand of server you're using (Tomcat, since you're in the Tomcat forum).

The server-dependent deployment descriptor is the Context. You can embed a Context in the Tomcat server.xm file, although this is strongly discouraged. More commonly, you'd create a file with the same name as your intended URL context path and and ".xml" file extension and place that in the Tomcat/conf/Catalina/localhost directory.

You can also add a META-INF/context.xml file in the WAR itself, which is convenient for holding a default Context. Using that means that you'd then only have to deploy the WAR itself, and not both the WAR and an independent context.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!