1

I'm running a .war file in 3 different Servers, but for each server I need a different description in the web.xml file, that will be accessed like:

context.getInitParameter("CompanyKey")

Is there a equivalent for a server file? It's being a pain to change this file at each deploy.

Im currently using GlassFish 4.1

DMurta
  • 315
  • 1
  • 10
  • For glassfish there is glassfish-web.xml http://docs.oracle.com/cd/E18930_01/html/821-2417/beaql.html – seenukarthi Aug 08 '15 at 17:14
  • glassfish-web.xml is a parallel file to web.xml, right? I need a file that will placed in each server and accessible by my war file – DMurta Aug 08 '15 at 17:21

1 Answers1

0

After some search, I found out that GlassFish holds a file called default-web.xml in the config folder.

All variables listed here takes precedence over the variables in the application (war) web.xml.

I just transferred my variables there and it worked!

Some helpful links for those searching about web.xml, context.xml and default-web.xml (it helped me to get to my answer):

  1. https://blogs.oracle.com/alexismp/entry/how_to_use_tomcat_context

  2. http://docs.oracle.com/cd/E19798-01/821-1752/geurd/index.html

  3. How can I share a variable or object between two or more Servlets?

  4. What is the glassfish alternative to context.xml

Community
  • 1
  • 1
DMurta
  • 315
  • 1
  • 10