• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat 6 + jsp

 
Davide Manca
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Davide Manca
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Davide Manca
Greenhorn
Posts: 3
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic