tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chaney <a...@compulsivecreative.com>
Subject Re: Setting /WebContent as ROOT for an application
Date Sat, 13 Dec 2008 20:02:16 GMT
In Eclipse, assuming you have the WTP tools installed, you create a 
'Dynamic Web Project.'
This has a folder structure of which the essence is:

MyApp
    src
       com
            mypackage
                Abc.java
    build
       com
          mypackage
             Abc.class
      
    WebContent
       index.html (or jsp or whatever)
       WEB-INF
          web.xml
          lib
             a.jar
             b.jar

In the above com.mypackage.Abc.java is your web application, and a.jar 
and b.jar are any runtime libraries that application requires (NOT stuff 
already in $TOMCAT_HOME/lib)

When you compile and run applications within eclipse it copies the 
WebContent structure to the webapps directory of its (internal) tomcat, 
and in WEB-INF creates a folder called classes and copies the contents 
of the 'build' folder their.

This normally happens automatically every time you start the server 
inside eclipse.

When you want to deploy the project to an external instance of tomcat 
(eg a production server) you right-click on the Export.. option in the 
project context menu and then select WAR (there's a suprise). The war 
file by default has the project name (in the above expample MyApp.war. 
This should be copied to the webapps folder of the tomcat instance and 
if you've stuck to the normal server.xml configuration it should deploy. 
It will be available at http://the.tomcat.instance:8080/MyApp/index.html 
(or jspt or whatever)

This is an incredibly brief summary of what is undoubtedly an obscure 
and complex process for the new-comer (been there.. done that...) and 
which sadly is not especially well EXPLAINED anywhere that I have found. 
There are some 'cookbook' type recipes on the web, which are often 
inconsitent.

Hope that helps

Alan Chaney (a daily eclipse user, but hardly an eclipse guru...)










Markus Schönhaber wrote:
> Tom Blank:
>
>   
>> The reason why I'm asking is, because I'm using eclipse and its
>> 'dynamic web project' structure.
>>     
>
> I'm no Eclipse user either, but AFAIR the folder "Webapps" is part of an
> Eclipse Dynamic Web Project. And a project folder is not meant to be
> simply copied to Tomcat's appBase (judging from your OP, it seems to me
> that's what you've been doing).
>
> You could, for example, export your project to a WAR file and deploy this.
> Experienced Eclipse users may know of other/better ways of deployment.
> You might consider asking in the appropriate Eclipse mailinglist/newsgroup.
>
> Regards
>   mks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> !DSPAM:4943f4d3100632009820482!
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message