Tre e mezzo [JJRumi’s blog]

October 30th, 2006

TFC - Ubuntu 6.06 & Tomcat 5

Posted by jjrumi in TFC

After doing some UML work, it’s time to install the application server. I’ve choosen Apache Tomcat.

INSTALLATION:

To install tomcat I used:
:~$ sudo apt-get install apache2 tomcat5 tomcat5-webapps tomcat5-admin

With apache2 and tomcat5 I installed the application server.
tomcat5-webapps includes documentation and examples (always useful to have something to look at).
tomcat5-admin provides a web interface for administration tasks.

To use the above command, one needs to add some extra repositories (Multiverse repository). Further information.

To start/restart Tomcat: :~$ sudo /etc/init.d/tomcat5 [start|restart]
Tomcat’s default configuration sets listening port to 8180, so acceding http://localhost:8180 will be enough.
In the page displayed is an important note:
“NOTE: For security reasons, using the administration webapp is restricted to users with role “admin”. The manager webapp is restricted to users with role “manager”. Users are defined in $CATALINA_HOME/conf/tomcat-users.xml.”

The examples (tomcat5-webapps) were installed at /usr/share/tomcat5/webapps/
/etc/default/tomcat5 includes some important variables (such as JAVA_HOME, CATALINA_BASE, LOGFILE_DAYS, etc…)
The configuration files (server.xml y web.xml) are located at /etc/tomcat5/
/var/lib/tomcat5/ is the base directory of my Tomcat installation and /var/lib/webapps/ is where the the web applications should be located.

FIRST WEB APPLICATION:
Now it’s time to add the first webapp.

Tomcat uses the WAR structure.

Standard Directory Layout –> Where are we playing today?

* /WEB-INF/web.xml –> This is an XML file describing the servlets and other components that make up your application.

* /WEB-INF/classes/ –> This directory contains any Java class files (and associated resources) required for your application.
It’s important to note that a Java class named com.mycompany.mypackage.MyServlet would need to be stored in a file named /WEB-INF/classes/com/mycompany/mypackage/MyServlet.class.

* /WEB-INF/lib/ –> This directory contains JAR files that contain Java class files required for your application.
If you want a JAR to be visible for all of your webapps, place it in /var/lib/tomcat5/shared/lib

We can use the webapp http://localhost:8180/manager/html for deploy our applications.

Further information for the different possibilities of this tool.

I hope this will be enough for today ;)

Leave a reply



Creative Commons License
This work is licensed under a Creative Commons Attribution 2.5 License.