- This topic has 9 replies, 5 voices, and was last updated 19 years, 4 months ago by Daniel Serodio.
-
AuthorPosts
-
William L. OlingerMemberI am having an issue where compiling a java file that is part of an exploaded archive causes the Tomcat server to restart the app context. Is there any way to keep the app from restarting just because I saved. I would like to have the code just get hot replaced on the server.
Tomcat 5.0.28
Java 1.4.02_6
Riyad KallaMemberThe restarting of the context is how Tomcat handles the new file, you can tell the context “reloadable=false” and it won’t reload… but then you won’t be able to see your changed class unless you manually restarted your context.
FinchMember@support-rkalla wrote:
The restarting of the context is how Tomcat handles the new file
Is it? Which file? web.xml?
For all other files, the hot code replace works just fine for me!
JSPs are no problem at all, but even Java files can usually be replaced without any problem. (you just cannot introduce new members or methods or change method signatures).For me, this even works when I hit a breakpoint and fix the next line. When I save, the Java code is replaced and the method I was in is restarted from the first line. That’s a really helpful thing sometimes!
Which file are we talking about?
Riyad KallaMemberIs it? Which file? web.xml?
It is set in your server.xml file for Tomcat 4 and set in your individual context files in Tomcat 5+
FinchMember@support-rkalla wrote:
Is it? Which file? web.xml?
It is set in your server.xml file for Tomcat 4 and set in your individual context files in Tomcat 5+
I think (well, I know for a fact *ggg*) that the original author talked about “compiling a Java file”. Which Java file would trigger a context reload?
William L. OlingerMemberHi all,
There have been a number of replies since my original post. Here are some additional details. The problem began occuring when we created a context.xml file and placed it in the tomcat/conf/Catalina/localhost dir. Every change to java files in the src tree causes the server to reload the context.
-wlolinger
Riyad KallaMemberwlolinger,
First make sure you didn’t actually leave the file named context.xml, it needs to be named the same name as your web context (http://localhost:8080/myapp == myapp.xml)Second, edit the context file and for the context set the attribute reloadable to false (reloadable=false)
William L. OlingerMemberRiyad,
I verified the name is correct. As for the reloadable=false, If I set false then Tomcat will not do the hot code deploy will it?
I want the new code to be reflected, I just don’t want to reload the entire app.Let me know if I was not clear. In the meantime I will try setting reload to false.
wlolinger
Robert VargaParticipant@Finch wrote:
@support-rkalla wrote:
Is it? Which file? web.xml?
It is set in your server.xml file for Tomcat 4 and set in your individual context files in Tomcat 5+
I think (well, I know for a fact *ggg*) that the original author talked about “compiling a Java file”. Which Java file would trigger a context reload?
I am not sure, but I can well imagine that reloading a ServletContextListener implementor class might trigger the reloading of the web-application containing the ServletContextListener.
I also found that changing the date of web.xml does trigger the reloading of the web-application.
Regards,
Robert Varga
Daniel SerodioMember@wlolinger wrote:
Riyad,
I verified the name is correct. As for the reloadable=false, If I set false then Tomcat will not do the hot code deploy will it?
I want the new code to be reflected, I just don’t want to reload the entire app.Let me know if I was not clear. In the meantime I will try setting reload to false.
wlolinger
Eclipse does the hot code replace, not Tomcat. So even setting reloadable=”false”, hot code replace will still work.
HTH,
Daniel Serodio -
AuthorPosts