Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Adding Static Web Project to Tomcat server
icon5.gif  Adding Static Web Project to Tomcat server [message #705049] Fri, 29 July 2011 07:21 Go to next message
Luís de Sousa is currently offline Luís de Sousa
Messages: 133
Registered: July 2009
Senior Member
Hello everyone,

I managed to configure an existing Tomcat server in Eclipse following this guide and selecting the "Use Tomcat installation" option at the "Server Locations" tab.

Presently I'm able to create new Dynamic Web Projects associated with this server, by selecting the appropriate "Target runtime" option at the project creation menu. The problem is that when I try to create a Static Web Project no options show up in the "Target runtime" drop down list.

Is it possible to associate Static Web Projects to a Tomcat server? Does it need a different server configuration?

Thank you,

Luís
Re: Adding Static Web Project to Tomcat server [message #707343 is a reply to message #705049] Mon, 01 August 2011 09:27 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1305
Registered: July 2009
Senior Member
On 7/29/2011 7:21 AM, Luis wrote:
> Hello everyone,
>
> I managed to configure an existing Tomcat server in Eclipse following
> http://www.mulesoft.com/tomcat-wtp and selecting the "Use Tomcat
> installation" option at the "Server Locations" tab.
> Presently I'm able to create new Dynamic Web Projects associated with
> this server, by selecting the appropriate "Target runtime" option at the
> project creation menu. The problem is that when I try to create a Static
> Web Project no options show up in the "Target runtime" drop down list.
>
> Is it possible to associate Static Web Projects to a Tomcat server? Does
> it need a different server configuration?
>
> Thank you,
>
> Luís

Technically, Tomcat only supports serving Web applications. WTP doesn't
currently support adding Static Web projects to servers which are
Servlet Containers, like Tomcat. Not all versions of Tomcat could
support this, but recent versions probably can. I'll look into that as
a feature for WTP 3.4.

In the meantime, I can think of a couple workarounds that would let
serve your static content with Tomcat and have Run As -> Run on Server work.

1. The simplest is to create Dynamic Web projects and put your static
content in the WebContent folder like you do now in the Static Web project.

2. Only slightly more complicated is to create "proxy" Dynamic Web
project and link it's WebContent folder to the "WebContent" folder of
the Static Web project. You could add this "proxy" project to the
Tomcat server and it should serve the same content as your Static Web
project. The "Serve modules without publishing" option available in the
Tomcat server editor would no longer work, but that's probably not
important. Run As -> Run on Server would still work.

Cheers,
Larry

P.S. I assume you are aware that enabling the "Use Tomcat installation"
option means that the Tomcat server in Eclipse now "owns" your Tomcat
installation and are okay with that. If you aren't sure what this
means, see the Tomcat FAQ[1] for details.

[1] http://wiki.eclipse.org/WTP_Tomcat_FAQ
Re: Adding Static Web Project to Tomcat server [message #708261 is a reply to message #707343] Tue, 02 August 2011 12:15 Go to previous message
Luís de Sousa is currently offline Luís de Sousa
Messages: 133
Registered: July 2009
Senior Member
Hi Larry, thank you for your reply. Option 1. suits my needs well, so I won't go any further.

I'm aware Eclipse takes over the original Tomcat installation so it can start, stop, restart, publish etc. Right now I need to shutdown Tomcat manually every time I open Eclipse, otherwise it won't be able to do anything. But that's a different issue.

Thank you,

Luís
Previous Topic:Problem opening jsp in editor
Next Topic:Trouble adding Resin Application Server to eclipse Helios - 3.6.2
Goto Forum:
  


Current Time: Fri Aug 29 08:16:58 EDT 2014

Powered by FUDForum. Page generated in 0.02302 seconds