In .Net this is called "Run as Root"
Project changes:
- Right click project
- Select properties
- Select Web Prject Settings
- Change Context root to /
Tomcat server changes:
- Double click the server.
Change Host name to localhost- Change HTTP/1.1 port to 80
Tomcat server changes for SSL:
- Open the tomcat server project
- Open tomcat server.xml
- Within the <Connector
- change port to 80
- change redirectProt to 443
Old stuff below this line…
==================================
Eclipse is by far my favorite IDE, which makes Rational Application Developer bearable. The one thing I’ve been spoiled on in RAD is being able to run the WebSphere Test Environment inside the development environment and be able to have some level of hot deploy when modifying classes or jsp’s in the web project. This brings me to my problem with Eclipse and Tomcat, Eclipse provides great support for adding a Tomcat server to run in your IDE, but the default classpath set up forces you to do a build and restart almost everytime you modify a JSP or Class, this is a real pain. The other pain is that by default when you set up a web project, eclipse decides to build your src files into a build directory rather than just building them directly into the web project’s WEB-INF/classes directory.
This is what I’m here to solve. I’m assuming your using Eclipse 3.2 (Callisto) with the Web Tools installed, JDK 1.5 or 1.6, and Tomcat 5.5 or 6. May work in earlier versions, but I haven’t set up any projects like that recently.
Create a new Dynamic Web Project
- Open Eclipse
- Create a New Web Project
- Open the Java Perspective
- Right click and choose New -> Project
- Under Web Folder Choose Dynamic Web Project Click Next, Click Next
- Under Project Facets choose Dynamic Web Module, Java, Click Next
- Change Context Root to / Click Finish
Change the Build Path
- Right click the Project and choose Properties
- Choose Java Build Path in the Left Panel, Click the Source Tab
- Change the Default output folder to: yourprojectname/WebContent/WEB-INF/classes
- Click OK
Create Tomcat Server
- Right click and choose New -> Other
- Under Server Folder Choose Server Click Next
- Under Apache Choose Tomcat v5.5 Server Click Next
- Under Tomcat installation directory: Browse to the place where you unzipped the Tomcat installation
- Under JRE: Make sure jre1.5.x is selected, you may need to add the jre if a different one is installed on your computer. Click Next
- Choose the project you created from Available projects to Configured projects Click Finish
- Open the Server View, if it’s not displayed already – Window –> Show View–> Other–> Choose Servers under Server
- Save the Perspective so that the Servers View will also be displayed
- The server you just created will appear in the Servers View
- Right Click the server and choose Move to Workspace
- Double click the Server and the Server Overview will be opened.
- Change the Server Name to something meaningful like YourProjectName Server, Save the configuration
- Close the editor and it will ask you if you want to rename the diretory to match the server name, click yes
- Open the server.xml
- Change the appBase attribute of the Host node to contain the absolute path to your workspace directory ex. <Host appBase=”d:\web” autoDeploy=”true” name=”localhost” unpackWARs=”false” xmlNamespaceAware=”false” xmlValidation=”false”>
- Change the port attribute of the Connector node to 80 and the redirectPort attribute to 443
- Change the docBase attribute of the Context Node to contain the absolute path to your WebContent folder ex. <Context docBase=”d:\web\yourprojectname\WebContent” path=”/” reloadable=”true” source=”org.eclipse.jst.j2ee.server:forensicsalvage”/>
You should be able to start the server up from the Server View and view you application and make live changes to your jsp’s, which should only require a refresh now.
http://greatwebguy.com/programming/eclipse/make-eclipse-and-tomcat-play-nice-together/