Meaningless Drivel is fun!
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

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

Long Thai

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


    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: 17417

    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.
    It is sorta covered in the JavaRanch Style Guide.
    subject: CATALINA_BASE/conf/Catalina/localhost/<APPNAME>.xml is different from application's context.xml
    It's not a secret anymore!