This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes CATALINA_BASE/conf/Catalina/localhost/<APPNAME>.xml is different from application's context.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "CATALINA_BASE/conf/Catalina/localhost/<APPNAME>.xml is different from application Watch "CATALINA_BASE/conf/Catalina/localhost/<APPNAME>.xml is different from application New topic
Author

CATALINA_BASE/conf/Catalina/localhost/<APPNAME>.xml is different from application's context.xml

Long Thai
Greenhorn

Joined: Nov 19, 2012
Posts: 1
I've been running a web application on Tomcat, when I make some changes in the application, including context.xml, and redeploy it, I start receiving an exception:

After looking around, I realise that the appname.xml in CATALINA_BASE/conf/Catalina/localhost is different than an updated context.xml, so when an application tries to look up a jndi resource, it cannot find any. According to this, 2 files must be exactly the same. I come up with 2 explanations, and questions, for this case:
  • There is an issue that makes appname.xml unchanged during redeployment
  • Although I change context.xml, tomcat still stores an old version somewhere and use it instead of a new one

  • I wonder if there is anyone see those issues before, if there is, I really appreciate any solutions. Or, if you have other explanation and/or question for my case, you're welcome! Thanks

    M

    PS: the tomcat is in my company's server, so I cannot just go and change appname.xml directly
    Tim Holloway
    Saloon Keeper

    Joined: Jun 25, 2001
    Posts: 17030
        
      26

    Sorry about the delay. We were trying to determine whether your display name met our requirements (no "handles", nicknames or aliases).

    Tomcat can obtain (or synthesize) a Context definition from a number of different places. If there are definitions in more than one place, the definitions are not merged. Instead a hierarchy exists to determine which Context will be used. The rules are in the Tomcat documentation.

    An explicit CATALINA_BASE/conf/Catalina/localhost/<APPNAME>.xml will take precedence over the META-INF/context.xml in a WAR (if one exists there). You should note, however, that "APPNAME" (the Context filename) will be the context name used, regardless of what name is coded on the Context element itself.

    And, of course, when you re-deploy a webapp, you need to delete the exploded copy of the old WAR from the Tomcat webapps directory if one exists there, since that copy will be used instead of a newer WAR file.


    An IDE is no substitute for an Intelligent Developer.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: CATALINA_BASE/conf/Catalina/localhost/<APPNAME>.xml is different from application's context.xml
     
    It's not a secret anymore!