{"id":546,"date":"2010-12-18T22:33:03","date_gmt":"2010-12-18T22:33:03","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=546"},"modified":"2011-11-17T12:22:26","modified_gmt":"2011-11-17T12:22:26","slug":"using-the-integrated-tomcat-server-adapter-in-eclipse","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=546","title":{"rendered":"Using the Integrated Tomcat Server Adapter in Eclipse"},"content":{"rendered":"<p><strong><span style=\"text-decoration: underline;\">Update<\/span><\/strong><\/p>\n<p>Another post <strong><a title=\"http:\/\/salientsoft.co.uk\/?p=840\" href=\"http:\/\/salientsoft.co.uk\/?p=840\">here<\/a><\/strong> describes how to enable and control logging when using the Tomcat Server Adapter, as it is not enabled by default. As a result, I changed my thinking and have switched to using the Workspace Metadata to store the server configuration (as detailed below). This allows more convenient editing of the <strong>logging.properties <\/strong>file in Eclipse, and also allows a separate Tomcat configuration for each Eclipse Workspace. I have not experienced any corruption\/pollution issues from working this way.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Original Post<\/span><\/strong><\/p>\n<p>I use this a lot for prototyping as it is significantly faster for deployment and has less overhead\u00a0than Glassfish. I run JSF\/ICEfaces\/JPA applications by running JPA outside the container &#8211; see <a title=\"http:\/\/salientsoft.co.uk\/?p=338\" href=\"http:\/\/salientsoft.co.uk\/?p=338\"><strong>here<\/strong> <\/a>for more details.<\/p>\n<p>When running Tomcat inside Eclipse, it runs within its own context, i.e. separately from the installed Tomcat Server. Therefore, you should stop Tomcat externally when using it internally via Eclipse&#8217;s Tomcat Server Adapter.<\/p>\n<p>You can use the adapter by right clicking in the Server view and clicking on <strong>New<\/strong>, then choosing the appropriate version of the Apache Tomcat adapter, browsing for the installation directory for Tomcat in the process.<\/p>\n<p>When using this, you have 3 choices as to where the applications deployed to Tomcat are stored, all of which may be chosen by opening the Server Window for your Tomcat Server in Eclipse. As I point out <strong>here<\/strong>, there is often some ambiguity between which properties you change from the <strong>properties<\/strong> context menu option (resulting in a popup), and which are from the Server view via the\u00a0<strong>Open<\/strong> option (also obtained by double clicking the server entry in the server view). In this case, the 3 choices are listed under the Server view\u00a0(<strong>Open\/double click option), <\/strong>but they are typically shown disabled and it is not always consistent as to\u00a0how to enable the selections. Firstly stop all running applications on the server, and stop the server. Secondly,\u00a0clear out any applications from the server by using the <strong>Clean <\/strong>context menu option, and\/or visiting the <strong>Modules<\/strong> tab in the Server view and removing all applications there. You can also click the <strong>Switch Location<\/strong> button on the <strong>properties<\/strong> context menu popup. You will also need to refresh\/reopen the Server view window to ensure that changes are picked up. Once you have reached the point where the the server locations are modifiable, you have the following choices :-<\/p>\n<ol>\n<li>Workspace Metadata (does not modify Tomcat Installation)<\/li>\n<li>Use Tomcat Installation (takes control of Tomcat Installation)<\/li>\n<li>Use Custom Location (does not modify Tomcat Installation) :-<br \/>\n<strong>Server Path: <\/strong>Top level location for all the deployed apps and other Tomcat metadata<br \/>\n<strong>Deploy Path: <\/strong>Subfolder under the <strong>Server Path, <\/strong>where the apps sit &#8211; defaults to <strong>wtpwebapps<\/strong><\/li>\n<\/ol>\n<p>My preference is 3. &#8211; I like to avoid polluting the main Tomcat installation with Eclipse development stuff, as I can then use it for other purposes. Also, I like to avoid storing the Tomcat applications in the Eclipse workspace metadata. The metadata is cluttered enough as it is, and is sometimes prone to pollution and problems with Eclipse not starting (see <a title=\"http:\/\/salientsoft.co.uk\/?p=98\" href=\"http:\/\/salientsoft.co.uk\/?p=98\"><strong>here<\/strong><\/a>). I therefore like to keep this data in a custom location separate from both the Metadata and the Tomcat installation, but as part of a folder structure which includes the workspaces. I also include any libraries which are shared between workspaces (e.g. JSF\/ICEfaces plugins)\u00a0in the same structure. See <a title=\"http:\/\/salientsoft.co.uk\/?p=98\" href=\"http:\/\/salientsoft.co.uk\/?p=98\"><strong>here<\/strong> <\/a> for details about sharing downloaded plugin\u00a0libraries across multiple\u00a0workspaces by exporting\/importing Eclipse preferences.<\/p>\n<p>My typical folder structure might be as follows :-<\/p>\n<p><strong>Dev<\/strong> (top level\u00a0(sub)folder somewhere)<br \/>\n<strong>Tomcat<\/strong> (custom Tomcat apps location\u00a0as above)<br \/>\n<strong>webapps<\/strong> (my preferred setting for the <strong>Deploy Path:<\/strong> above)<br \/>\n<strong>Libraries<\/strong> (Top level for libraries shared between workspaces, such as JSF\/ICEfaces plugin libraries)<br \/>\n<strong>Workspaces<\/strong> (All Eclipse workspaces live under here)<br \/>\n<strong>Workspace 1<br \/>\nProject 1<br \/>\nProject 2<br \/>\nProject 3<\/strong><br \/>\n<strong>Workspace 2<br \/>\nProject 4<br \/>\nProject 5<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update Another post here describes how to enable and control logging when using the Tomcat Server Adapter, as it is not enabled by default. As a result, I changed my thinking and have switched to using the Workspace Metadata to store the server configuration (as detailed below). This allows more convenient editing of the logging.properties [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12],"tags":[9,23,184,183,37],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/546"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=546"}],"version-history":[{"count":12,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions"}],"predecessor-version":[{"id":1559,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/546\/revisions\/1559"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}