
























When should you use a debugger during development? At ALL times! At least that's my view.
Isn't that a hassle? Well debugging sure can be, but if you setup your environment in a specific way, it can actually become very fast and almost transaprent. I like transparent!
Here are steps I take to configure my tomcat (I've followed the same steps with JBoss):
/bundles/tomcat-6.0.x)org.apache.catalina.startup.Bootstrap
start -Xms1024m
-Xmx1024m
-XX:PermSize=128m
-XX:MaxPermSize=256m
-XX:+CMSClassUnloadingEnabled
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=true
-Dcatalina.base=/bundles/tomcat-6.0.x
-Dcatalina.home=/bundles/tomcat-6.0.x
-Djava.io.tmpdir=/bundles/tomcat-6.0.x/temp
-Dexternal-properties=${workspace_loc:portal}/portal-web/docroot/WEB-INF/src/portal-developer-tomcat.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=/bundles/tomcat-6.0.x/conf/logging.properties
You many notice that I included a reference to my portal project's portal-developer-tomcat.properties file. This way I can change portal settings and only need to restart the portal without a redeploy, which is very convenient.
You may also notice that I included tomcat's juli log manager so that all the normal web app configurations work as expected and in the Eclipse console, which is also very nice.
Adjust your heap settings as desired, but the above settings have worked for me in 99.999% of cases.
/bundles/tomcat-6.0.x/bin. Notice that this is the tomcat path, plus the /bin folder./bundles/tomcat-6.0.x/bin. Optionally here you can add any plugin projects that you are working on, as well as adding the path to the jsp java classes (typically /bundles/tomcat-6.0.x/work/Catalina/localhost/_)
You should see at this point output on the Eclipse console showing that tomcat is starting up.
I've been using this techinque for at least 3 years and I run the portal this way 99.999% of the time. By doing so, I can at any point in time add a breakpoint and start trouble shooting and I don't have to worry about re-connecting to or restarting the portal in debug mode, I know it's already done.
If you want to add any other java apps this way, the simples technique is to first run the app in the traditional way, then observe the process log to see what the full command that was actually used to start it, and from where. Once you know that, you can add any app to Eclipse Run Configuration.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。