Configuring the Apache Tomcat Server in Eclipse IDE

Configuring the Server

Eclipse provides integration for the Apache Tomcat Web environment and this can be used for rapid Stardust deployments within Eclipse. 


Prerequisites
  • Download Apache Tomcat from jakarta.apache.org/tomcat
  • Extract the compressed file containing Apache Tomcat on your local file system.

To establish Tomcat integration in Eclipse:
  1. From the Eclipse main menu choose File > New > Other...
  2. Select Server > Server.
  3. Click Next.
    Eclipse Server dialog 
    Figure: Define a New Server
  4. Select Tomcat vx.x Server
  5. Click Next.
    Choose Tomcat 
    Figure: Choose Tomcat version
  6. Browse to the folder of your Tomcat installation.
    Browse to Installation Folder 
    Figure: Browse to Installation Folder
  7. Select Finish.
Open the Servers view to see the server listed:
  1. In the main menu select Window > Show View.
  2. Choose Other... > Server > Servers.
  3. Test your setup of the Tomcat server.
    1. Open a Web browser.
    2. Type the Web address http://localhost:8080/. If you see the Apache Tomcat start page, you have successfully set up your Tomcat server.
Eclipse Server View 
Figure: The Server View
This server configuration can be used for multiple Web projects.


Setting the Server Launch Configuration

To avoid running out of PermGenSpace, increase the size of the permanent generation memory by setting the -XX:MaxPermSize argument in the run configuration for the server.
To set the server configuration:
  1. In the server view right-click your server and choose Open.
  2. Select Open launch configuration.
Server Launch 
  1. In the Edit launch configuration properties dialog switch to the Arguments tab.
  2. In the VM arguments entry field enter the memory arguments for your server.
    For example for a Tomcat server set: -Xms128m -Xmx1024m -XX:MaxPermSize=256m
Server Arguments 
Figure: Setting Server Arguments for Tomcat
Please note that you might increase the maximum perm size according to your requirements.



0 comments: