Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where exactly does a jsp page get deployed when run via Netbeans or Eclipse?

In Netbeans, I created a new default web application project which had an index.jsp. In Tools > Servers I had already pointed Netbeans to the place I had extracted Tomcat (C:\apache-tomcat-7.0.42).

I ran the program, the browser opened and the index.jsp file was displayed.

What I don't understand is, that the index.jsp file was not automatically copied to the Tomcat folder and it still worked. I thought that for a file to work, it had to be copied to the C:\apache-tomcat-7.0.42\webapps\ROOT\WEB-INF folder.

  1. How does Netbeans manage to execute the index.jsp file without copying it to the Tomcat folder?
  2. When I run the program in Netbeans and Eclipse, it shows that it is starting the Tomcat server. Is it starting the same server in C:\apache-tomcat-7.0.42 or is it creating a separate 'virtual' kind of an instance of the server and running it in the Netbeans/Eclipse workspace?
like image 775
Jonathan Avatar asked Oct 20 '22 21:10

Jonathan


1 Answers

First of all, you need to know that Tomcat has two configurable directories:

  • CATALINA_HOME, the directory where you chose to install Tomcat. e. g. c:\Program Files\Apache Software Foundation\Tomcat 6.0. Tomcat uses this variable to find its internal classes and libraries.

  • CATALINA_BASE the directory of the configuration files and directories, such as the web application directories. If CATALINA_BASE isn't set, it defaults to the value of CATALINA_HOME. e. g. C:\Users\JVerstry\.netBeans\7.1.2\apache-tomcat-7.0.22.0_base


NetBeans

In NetBeans, you will see that in:

Tomcat Configuration

NetBeans copies the files to the Catalina Base directory for deploy. This directory is in the user profile directory.


eclipse

In eclipse, you will see that in:

Tomcat metadata

eclipse copies the files for deploy, by default, in the .metadata directory of the workspace.

like image 61
Paul Vargas Avatar answered Oct 23 '22 21:10

Paul Vargas