Tomcat and Netbeans

This article describes what is necessary to use a Tomcat installed with portage from the Netbeans IDE. This is a bit complicated because Netbeans assumes that all files belonging to Tomcat are in one directory. If you use the Tomcat from Portage, this is not the case. The portage installation of tomcat is split into several directories to meet the File Hierarchy Standard (FHS).

There is already an ebuild in the java-experimental overlay which does the steps describe in this article. This article is a step-by-step guide which has created on base of the actions done by the ebuild.

This guide is written for Tomcat 6 and Netbeans 6.5. It is assumed that you have installed them successfully and that you are using the packages from the portage tree.

Required Netbeans modules
Netbeans has to be build with some modules if you want to use Tomcat with Netbeans. These modules are required:


 * j2ee
 * mobility
 * groovy
 * gsf

Groups
You have to add all users which shall be able to use Tomcat from Netbeans to the tomcat group. You will have to logout and login to get the new group membership active.

Enviroment variables
For the following process, some enviroment variables are needed. The get them, source :

Find out the locations of the parts of tomcat
Input the following your echo commands into your terminal and note the results:

Check symlinks
The ebuild mentioned in the summary checks some symlinks also. You can do is also with these commands:

Workaround for a bug in Netbeans
Netbeans seems to have a problem with reading the server.xml from CATALINA_BASE. Because of this, you have to create a symlink for the configuration in CATALINA_HOME:

Add a user and a password for the manager role to tomcat
Open the file /etc/tomcat-6/tomcat-user.xml and add an user and a password for the manager role:

If you are using digested passwords, please refer to http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#DigestedPasswords

Add the Tomcat to Netbeans
In Netbeans add the tomcat to the servers. The dialog can be found in the tools menu. If you get errors, please check if the user how is running Netbeans is in the tomcat group and if Netbeans is build with all modules required.