I am using sysdeo tomcat plugin 3.2.1 with eclipse 3.5.1 (Galileo) and tomcat 5.5.23 on windows XP. I can get tomcat plugin working in eclipse, and have extracted devloader.zip into [tomcat]\server\classes. I have also updated the context and now it has this entry:
<Context path="/myapp1" reloadable="true" docBase="F:\Work\eclipse_workspace\myapp1" workDir="F:\Work\eclipse_workspace\myapp1\work" >
<Logger className="org.apache.catalina.logger.SystemOutLogger" verbosity="4" timestamp="true"/>
<Loader className="org.apache.catalina.loader.DevLoader" reloadable="true" debug="1" useSystemClassLoaderAsParent="false" />
</Context>
I have activated devloader (in Project > Properties > Tomcat > Devloader Classpath) and have 'checked' all my classes and jars, I haven't 'checked' commons-loggin.jar jsp-api.jar, servlet-api.jar.
So on launching t开发者_开发知识库omcat via the plugin, I can get it running with devloader as shown in eclipse console view
[DevLoader] Starting DevLoader
[DevLoader] projectdir=F:\Work\eclipse_workspace\myapp1
[DevLoader] added file:/F:/Work/eclipse_workspace/myapp1/WEB-INF/classes/
[DevLoader] added file:/F:/Work/eclipse_workspace/myapp1/WEB-INF/lib/activation.jar
However, if I even add a single System.out.println into any java file and save it, the whole application gets reloaded (takes ~80 sec) which is as good as stopping/starting tomcat itself. I've tried adding -Xdebug in JAVA_OPTS in the catalina.bat but no luck :(
Can you please guide where I may be doing it wrong..
Please note that I can 'redeploy' the whole application on tomcat but that's not what I need, I am looking to be able to make small changes in java classes 'on-the-fly' while coding/debugging without having to wait for complete app restart. Another annoyance is that restarting tomcat/application causes the session/debug progress to be lost..
Can you please guide me how to go about it.
PS: I am not using any ant/maven scripts explicitly, just relying on eclipse to do the build for me (which it does).
I know this is an old thread, but what if you take off reloadable="true"
from the Context entry?
From the Tomcat site:
Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.
I'm not sure what true
does for you there as when I make code changes with it false
(or absent) it still finds the changes and hotdeploys them (though I have my docBase
set to my working dir). Maybe it's more useful if a new class or JAR is added to the respective path? Or if you don't use your working dir as your docBase? Yeah, I bet it's more for the latter situation so that Eclipse/Tomcat will find the change in the local code and then push it to the remote version (with respect to Eclipse, not your machine necessarily) ... so if you do set your docBase to your working directory you probably never need to set reloadable
to true
.
If you do not require DevLoader to be loaded, and by mistake you have clicked something in Eclipse: open server.xml, delete the Context which points to DevLoader, and then try starting the Tomcat. You won't get any error (provided you don't require Devloder).
精彩评论