facebook

The best way to create .war file for a web project [Closed]

  1. MyEclipse IDE
  2.  > 
  3. Feature Requests
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #204239 Reply

    qingster_xie
    Member

    I’m using MyEclipse v2.7-RC2, Windows 2000, Tomcat 4 on my local machine for development. Later, I want to deploy my project on a remote Tomcat server. I think the only way to do this is creating a .war file and upload it. Is it true? If it’s true, what’s the best way to make .war file?

    Another question is that I notice server.xml was not modified when I deploy my project locally, only the files were copied to tomcat/webapps dir. I wonder how Tomcat know about the new application while the <context> tag wasn’t added to it’s server.xml?

    Thanks,

    Qing

    #204243 Reply

    Riyad Kalla
    Member

    Qing,

    The easiest way to make a WAR file is to setup a new “packaged deployment” in MyEclipse, this will actually make a WAR file for you. Secondly, when an application is deployed in a WAR format, you container (Tomcat) needs to be setup to deploy these packaged applications, so you can just drop them in the /webapps folder. If this is set to TRUE, Tomcat will create a new context automatically for the life of the application server. If you restart the server, the context is destroyed and only recreated if Tomcat sees the webapp under the /webapps folder. You can make this context permanent (for example if you NEED to, to setup a JNDI data source or something) by launching the Tomcat Adminstrator while the server is running, and hitting the “Commit Changes” button, this will write out a new server.xml file for you that will be persistent between reloads of the app server.

    #204244 Reply

    qingster_xie
    Member

    How to setup a new “packaged deployment” ? 🙂

    Qing

    #204246 Reply

    Riyad Kalla
    Member

    When you are in the MyEclipse perspective, on the toolbar you should have 4 buttons (New, Save, Save As, Print) then a set of 2 buttons (App server control, deployments). You want to click the deployments button. Then from the dropdown, select the project you are creating the deployment for, and select “packaged”.

    Note, that you need to have the app server you are trying to deploy to setup ahead of time, so the tool knows where to put the WAR file.

    You can then go retrieve the WAR file from the deployment directory (it should tell you in the textfield where it is putting it).

    #204252 Reply

    qingster_xie
    Member

    It works very well, just I have to stop and then start Tomcat each time I deploy the war file, so Tomcat will expand it. I wonder if there is a way to avoid this?

    #204253 Reply

    Riyad Kalla
    Member

    Qing,
    This is actually a Tomcat setting. If you run Tomcat, and login to the administrator, expand the “Service” node, then click on the “Host” node. In the right panel you want to set “Live Deploy” and “Unpack WARs” to true.

    #204285 Reply

    qingster_xie
    Member

    Riyad,

    Thank you very much for your quick and helpful support. I will read more documents about tomcat.

    Qing

    #204290 Reply

    Riyad Kalla
    Member

    No problem, I hope it helped!

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: The best way to create .war file for a web project [Closed]

You must be logged in to post in the forum log in