Saturday, May 17, 2014

Integrating tomcat plug-in with Eclipse [Debug web applications without restarting the server]

Installing tomcat plug-in>>


Benefit: >>  Web projects can be debugged without restarting the server. 
If  Eclipse version is grater than  4.2 (Eclipse Luna)>>> then use following plugin:



"Uqbar Tomcat XT Eclipse Plug-in"

If tomcat version is below 4.2 then use "tomcatPluginV33">>>>>>>>>>>>>>>
  1. Download the plugin from "http://www.eclipsetotale.com/tomcatPlugin.html"
  2. Unzip the tomcatPluginV33.zip in dropins or plugin folder of eclipse.



  1.  Start eclipse
  2.  Go to Window>Preferences>Tomcat
-          Set the path of tomcat server.

-          In Advance section, Unmark "Launch tomcat using security manager"

-          In JVM Settings section, Check JVM Settings are in place or not?
    


-          In Source path section, Check "Automatically compute source path"
      


-          In Tomcat manager app section, 
          ManagerApp url: http://localhost:8080/manager
          ManagerApp username: admin
          ManagerApp password:  admin

          
       

5. Click 'Apply' button.
6. Click 'Ok' button.

Integrating WebProject with tomcat>>

1      1.  Create a web project e.g. DemoServletProject
-       Directory structure of project should be like this (same should be provided in context setting below):


-       .classpath file should have following properties.

 <?xml version="1.0" encoding="UTF-8"?>
<classpath>
           <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
           <classpathentry kind="var" path="TOMCAT_HOME/lib/servlet-api.jar"/>
           <classpathentry kind="var" path="TOMCAT_HOME/lib/jasper.jar"/>
           <classpathentry kind="var" path="TOMCAT_HOME/lib/jsp-api.jar"/>
           <classpathentry kind="var" path="TOMCAT_HOME/lib/el-api.jar"/>
           <classpathentry kind="var" path="TOMCAT_HOME/lib/annotations-api.jar"/>
           <classpathentry kind="src" path="webapps/WEB-INF/src"/>
           <classpathentry kind="output" path="webapps/WEB-INF/classes"/>
</classpath>

1    2. Put the following mapping in the server.xml under <Host> element of TOMCAT_HOME.

<Context path="/DemoServletProject" reloadable="true" docBase="D:\Personal\Study\MyStuffs\Dropbox\EclipseWorkSpace\DemoServletProject\webapps"/>

2    3.  
Start tomcat from eclipse. Now you can easily debug without restarting the server.





Leave your comments/suggestions below, Otherwise the next time:)







No comments:

Post a Comment

Thanks for your comments/Suggestions.