This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Long Thai
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Pie
    Posts: 18009
    47
    Android Eclipse IDE Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.

     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic