GeeCON Prague 2014*
The moose likes Tomcat and the fly likes Tomcat 6 + jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 6 + jsp" Watch "Tomcat 6 + jsp" New topic
Author

Tomcat 6 + jsp

Davide Manca
Greenhorn

Joined: Nov 30, 2007
Posts: 3
Hello,



I have a problem using jsp on tomcat 6 + jdk 6. I have some jsp under a webapp. I want to Tomcat recompile them into .class files without restarting.



I already tried these:



In context.xml



<!-- The contents of this file will be loaded for each web application -->

<Context reloadable="true" privileged="true" antiResourceLocking="false">



<!-- Default set of monitored resources -->

<WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->

<!--

<Manager pathname="" />

-->



<!-- Uncomment this to enable Comet connection tacking (provides events

on session expiration as well as webapp lifecycle) -->

<!--

<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />

-->

</Context>



In server.xml:



<Host name="mysite.net" appBase="/store1/www-dev/mysite.net/doc_root/webapps"

unpackWARs="true" autoDeploy="true" deployOnStartup="false"

xmlValidation="false" xmlNamespaceAware="false">



<Context path="/ahtv"

docBase="/store1/www-dev/mysite.net/doc_root/webapps/ahtv"

workDir="/store1/www-dev/mysite.net/doc_root/webapps/ahtv/WEB-INF/work"

unpackWARs="true" autoDeploy="true" deployOnStartup="false" processTlds="true"

xmlValidation="false" xmlNamespaceAware="false"

debug="0" reloadable="true" privileged="true" antiResourceLocking="false">

<WatchedResource>WEB-INF/web.xml</WatchedResource>

<WatchedResource>jsp/index.jsp</WatchedResource>

<Manager pathname="" />



</Context>





</Host>



Thanks a lot for your help.



Ciao.

Dave.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

You will not have to restart the server or even the web app when updating a JSP. Tomcat will recognize that the file has been updated and automatically re-translate and recompile it for you. You do not need to change any configuration settings.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Davide Manca
Greenhorn

Joined: Nov 30, 2007
Posts: 3
Originally posted by Bear Bibeault:
You will not have to restart the server or even the web app when updating a JSP. Tomcat will recognize that the file has been updated and automatically re-translate and recompile it for you. You do not need to change any configuration settings.


Well...it doesn't!!! I have to restart Tomcat to re-translate and re-compile it!!! I used Resin too but I never had these kind of problems...

What should I do?

Thanks in advance.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Davide Manca:
What should I do?

You might first consider what type of tone a written statement like
"Well...it doesn't!!! I have to restart Tomcat to re-translate and re-compile it!!!" conveys.

You may not have meant it to look like you were snapping back, but in writing, that's how it appears and I would be hesitant to offer any more help after that reply.

Tomcat, like Resin, does not require a restart (of the container itself or of the application) for changes in JSP to take effect. I've seen this behavior in both Tomcat and other servers. For me it usually happens when I move JSPs from one machine to another when the two machines are in different time zones (or the clocks are not synced). Take a look at the last modified dates of your JSPs, if Tomcat doesn't see them as being newer than the one that was last compiled into a servlet, it won't bother to update it.

If you're on a Unix system, you can update all the JSPs in a directory with the the 'touch' command.

Also, do you know if your installation of Tomcat has been re-configured or somehow setup to behave differently than a default install?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Davide Manca
Greenhorn

Joined: Nov 30, 2007
Posts: 3
Originally posted by Ben Souther:

You might first consider what type of tone a written statement like
"Well...it doesn't!!! I have to restart Tomcat to re-translate and re-compile it!!!" conveys.

You may not have meant it to look like you were snapping back, but in writing, that's how it appears and I would be hesitant to offer any more help after that reply.

Tomcat, like Resin, does not require a restart (of the container itself or of the application) for changes in JSP to take effect. I've seen this behavior in both Tomcat and other servers. For me it usually happens when I move JSPs from one machine to another when the two machines are in different time zones (or the clocks are not synced). Take a look at the last modified dates of your JSPs, if Tomcat doesn't see them as being newer than the one that was last compiled into a servlet, it won't bother to update it.

If you're on a Unix system, you can update all the JSPs in a directory with the the 'touch' command.

Also, do you know if your installation of Tomcat has been re-configured or somehow setup to behave differently than a default install?


Sorry for my tone, well at last I fixed the problem, it was in the $catalina_home/conf/web.xml I don't know why the parameter development was set to false. And I don't know why it was present in the web.xml. I se it to true and all began to work.

Thanks to everyone and sorry again for the "!!!" I was just a bit stessed about it.
[ December 03, 2007: Message edited by: Davide Manca ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

We've all been there.
Thanks for reporting back with the solution.


There are both performance and security benefits to turning of the development mode in a production server. Someone on your end may have done it to optimize for production.
 
GeeCON Prague 2014
 
subject: Tomcat 6 + jsp