Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Where exactly does a jsp page get deployed when run via Eclipse?
Where exactly does a jsp page get deployed when run via Eclipse? [message #1179897] Sun, 10 November 2013 16:30 Go to next message
nav k is currently offline nav kFriend
Messages: 3
Registered: November 2013
Junior Member
I was told to ask in this forum, so... : http://www.eclipse.org/forums/index.php/t/590241/

I created a new default web application project which had an index.jsp. I had already pointed Eclipse 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.

How does Eclipse manage to execute the index.jsp file without copying it to the Tomcat folder?
When I run the program in 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 Eclipse workspace?

My catalina base folder points to C:\apache-tomcat-7.0.42 but when I created my servlet project, the NameHandler.class file got created in F:\Programming\Java\HelloWeb\build\web\WEB-INF\classes\org\mypackage\hello. I searched the tomcat directory, and the .class file wasn't there. Nor was any trace of my HelloWeb project. So my question persists, as to how the program works even if the .class file does not actually get deployed in the tomcat directory?
Re: Where exactly does a jsp page get deployed when run via Eclipse? [message #1181481 is a reply to message #1179897] Mon, 11 November 2013 16:27 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1310
Registered: July 2009
Senior Member
On 11/10/2013 11:30 AM, nav k wrote:
> I was told to ask in this forum, so... :
> http://www.eclipse.org/forums/index.php/t/590241/
>
> I created a new default web application project which had an index.jsp.
> I had already pointed Eclipse 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.
>
> How does Eclipse manage to execute the index.jsp file without copying it
> to the Tomcat folder?
> When I run the program in 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 Eclipse workspace?
>
> My catalina base folder points to C:\apache-tomcat-7.0.42 but when I
> created my servlet project, the NameHandler.class file got created in
> F:\Programming\Java\HelloWeb\build\web\WEB-INF\classes\org\mypackage\hello.
> I searched the tomcat directory, and the .class file wasn't there. Nor
> was any trace of my HelloWeb project. So my question persists, as to how
> the program works even if the .class file does not actually get deployed
> in the tomcat directory?

See the Tomcat FAQ [1]. It will explain how this is working. The quick
answer is that by default a separate instance of Tomcat is created under
the ".metadata" folder of your workspace. This avoids complications
that can occur trying to use your installed Tomcat directly.

Cheers,
Larry

[1] http://wiki.eclipse.org/WTP_Tomcat_FAQ
Re: Where exactly does a jsp page get deployed when run via Eclipse? [message #1186325 is a reply to message #1181481] Thu, 14 November 2013 16:32 Go to previous message
nav k is currently offline nav kFriend
Messages: 3
Registered: November 2013
Junior Member
Thank you so much! So I believe the answer is that Tomcat creates a separate instance of the Tomcat server that is run in the eclipse workspace. So there are the server.xml, catalina.policy, tomcat-users.xml, and web.xml files that get created. http://wiki.eclipse.org/WTP_Tomcat_FAQ#When_I_create_my_first_Tomcat_server.2C_why_is_a_Servers_project_created_in_my_workspace.3F

Previous Topic:utility project to reference EAR libraries
Next Topic:NullPointerException when adding Axis2 facet
Goto Forum:
  


Current Time: Wed Nov 26 03:30:58 GMT 2014

Powered by FUDForum. Page generated in 0.02182 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software