Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is Tomcat needs to be run everytime the Servlet Changes

 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

Any solution to the problem that Tomcat needs to be run everytime the servlet has undergone a small change?

If u know, reply.

Bye
Priya.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the Tomcat manager interface to restart just the web application instead of restarting the entire server.
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to use that Tomcat Manager Interface ???
 
Napa Sreedhar
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question should have been answered several times..
Turn on servlet reloadable to true

Refer to the link for Server configuration
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/context.html
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the solution of my problem,

Should I include the following in web.xml file of my specific appln.

<context-path>
<param-name>reloadable</param-name>
<param-value>true</param-value>
</context-path>

Does this solves the problem?
If I am wrong, correct me.

thanks
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

I added the following in f:\tomcat\server.xml file. and my appln resides in f:\tomcat\webapps\Pams

- <Context path="/Pams" docBase="f:\tomcat\webapps\Pams" debug="9" reloadable="true">
<Loader checkInterval="3" />
<Logger className="org.apache.catalina.logger.SystemOutLogger" timestamp="true" />
</Context>



U can observe that I set reloadable to "true"
But my problem was not solved....
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Priya Sri:
For the solution of my problem,

Should I include the following in web.xml file of my specific appln.

<context-path>
<param-name>reloadable</param-name>
<param-value>true</param-value>
</context-path>

Does this solves the problem?
If I am wrong, correct me.

thanks


Did you try this?
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vijay,

I tried that and it's worked for the first time when I changed the servlet and without restarting the tomcat....... but when second time I changed the servlet, it is not reflecting the changes done in the servlet.

I compiled the servlet after a small change. I didn' understand the reason.
 
kumm redd
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
first it depends on the version of tomcat you are using
but this html page addreses all .
http://www.coreservlets.com/Apache-Tomcat-Tutorial/
i would like to point you to specific subsection on this webpage..
just go thru
section 2.3,2.4 and 2.6 and also section 5.1

in brief::
Edit install_dir/conf/server.xml and uncomment this line: <Context path="" docBase="ROOT" debug="0"/>. Not necessary in Tomcat 4.0.3 and earlier. In most versions of Tomcat 5, the element is missing the trailing slash and you need to add it

Edit install_dir/conf/server.xml and add the following just above the entry for the ROOT context from the previous step:
<DefaultContext reloadable="true"/>

Go to install_dir/conf/web.xml (not .../server.xml) and uncomment the servlet and servlet-mapping elements that map the invoker servlet to /servlet/*. In Tomcat 4, you only need to uncomment the servlet-mapping element, and this is not necessary at all prior to Tomcat 4.1.12.

Test a packageless servlet. Compile a simple servlet, put the .class file in install_dir/webapps/ROOT/WEB-INF/classes, and access it with http://localhost/servlet/ServletName.


i tested my app with tomcat 5.0.28 .. it works fine ..

P.s approach mentioned by Jeroen Wenting 1.e, with manager interface is the recommended one compared to the the approach that we were all discussing

for the first time you can test with our approach,but use the second one after you get used with that..

if any doubtss ..lemme know
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi raj,

This is my code in server.xml file and Pams is my appln

<DefaultContext reloadable="true"/>
<Context path="/Pams" docBase="f:\tomcat\jakarta-tomcat-5.0.19\webapps\Pams" debug="0" reloadable="true">
<Loader checkInterval="3" />
<Logger className="org.apache.catalina.logger.SystemOutLogger" timestamp="true" />
</Context>

But it didn't work... not reflecting the changes..
 
Dark Vachor
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Priya Sri,

You configured Tomcat to reload your app properly, the proof is that it reloaded one time. You say it doesn't reload the second time. Try a third time, or try to "touch" you servlet file. It *may* reload the app. Usually it doesn't, once it's stuck you'll have to relaunch the whole of it.
Apache software is no more the quality one is used to be. It's now very buggy, and bloated, and clunky. Probably as Apache inexperienced programmers believe to be the king of programmers, reinvente the wheel the wrong way, and refuse any critics because they re the bests. At least they should RTFM about Java classes (system libraries), and stop writing useless code. And they should stop make people have to use *their* crappy log4j logger.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic