facebook

[Closed] Undeploy removes custom context file

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #270237 Reply

    Gary V. Jipp
    Member

    I am using Tomcat 5.5 as an application server for development with MyEclipse.

    In order to maintain a test environment I am using JNDI recources and environment entries to hold machine-specific parameters (jdbc, directories, etc). As recommented by Apache, these parameters are kept in:
    $CATALINA_HOME/conf/[enginename]/[hostname] and is named [context].xml where [context] matches the context of my web application.

    This is extremely common when you work on an application on a development machine but need to deploy on another.

    This works great of course but my carefully constructed test context file are always deleted from the …/conf/catalina/… folder when I undeploy a web application from MyEclipse. I expect the application directory to be deleted but not files that MyEclipse did not create itself on deployment.

    I have learned to keep a .zip copy in that folder but its a real pain to have to remember unzip it when I want to work on a particular application.

    Is there a way to make this not happen? Is there some preference I am not aware of?

    Even better, is there a “Deploy” feature of MyEclipse where I can specify a Context file separately and that context will be deployed along with the application? To what extent does MyEclipse have support for JNDI resources on deployment?

    Some may suggest that an alternative is to put the context information in the server.xml file. While this does work, it is both discouraged by the tomcat doc’s and causes nasty exceptions on startup if that particular app has not been deployed.

    Thanks for any help you can offer.

    #270242

    Riyad Kalla
    Member

    garyj,
    This deletion is being performed by Tomcat, not MyEclipse. Also something to mention is that custom contexts can be included in your web applications META-INF directory in your project, so when it gets deployed, Tomcat copies it into the directory you mentioned.

    The feature is mentioned in the Tomcat docs… I forgot if you call the file “context.xml” or if you have to name it the same as your project.

    #270253

    Gary V. Jipp
    Member

    Thanks for the quick reply. You are correct about the META-INF directory. If you want to include the context file right inside your .war file you have to name it META-INF/context.xml and it does the same thing as having a server-specific one on your server. Unfortunately these are not really “custom” contexts as you only get one file named “context.xml”

    The problem of course is that now that META-INF/context.xml is locked inside your war and everytime you want to deploy to a different server with dfferent hardware, directories, etc, you have to open your source and edit that context.xml file and then redeploy your war. Next time you want to work on the project you have to remember that you made those changes and roll them back or your dev box will be messed up. That’s why I never put that stuff in META-INF and make part of the deployment process copying a context file specific to the server into that server’s conf directory.

    Does MyEclipse have some elegant way of handling this? For instance a “deployer” that can take context variables or evan a context file. Then we could define several deployment scenarios for different servers.

    Maybe I’m just stuck with keeping a zipped copy unless anyone has another idea? I certainly do not claim to be an expert in this stuff!

    #270259

    Riyad Kalla
    Member

    Ohh gotcha, yes in that case I see what that wouldn’t work for you.

    MyEclipse doesn’t have any custom hooks that will allow you to do this… but I’m wondering why you need to keep undeploying your application and then having Tomcat remove the context for it? Why not just leave it deployed?

    #270264

    Gary V. Jipp
    Member

    Leaving the application deployed is certainly one solution although it becomes problematic with you start working on many different applications for several companies. The startup time for the server increases with each application added and its always nice to keep the servlet container clean while working on one set of applications.

    An alternative may be to use an ant builder to create production deployments and just use MyEclipse for dev deployments. Tomcat has a lot of ant hooks that let you deploy with a specified context.xml. I also think the tomcat manager has a command line option for including a custom context file although I have not tried it. That would be the hook that an IDE (such as myEclipse) would use to inject a custom context. hmm… sounds like an interesting plugin project 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: [Closed] Undeploy removes custom context file

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