I am trying to externalize a properties file outside of the app war in 
the tomcat context itself.This is so that the war can be build and ported to 
different env without having to change the properties file in each env every 
time.

Lets say that the properties file is called: app.properties
1) I placed all the properties, in tomcat_home/conf/context.xml and/or
 tomcat_home/conf/Catalina/localhost/context.xml. Eg.,
 
<Context path=/app>
<Parameter  name="maxExemptions" value="10" override="false"/>
</Context>

 When I start tomcat, I get the following error:
Jul 27, 2011 4:38:38 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor context.xml
Jul 27, 2011 4:38:38 PM org.apache.tomcat.util.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 45 column 43: Element type "Parameter" must 
be followed by either attribute 
specifications, ">" or "/>".
org.xml.sax.SAXParseException: Element type "Parameter" must be followed by 
either attribute specifications, "
>" or "/>".
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWra
pper.java:195)
        at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174
)
        at 
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
        at 
com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.seekCloseOfStartTag(XMLDocum
entFragmentScannerImpl.java:1395)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocument
FragmentScannerImpl.java:1328)
        at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(X

2) Also tried using <Environment name="maxExemptions" value="10"
         type="java.lang.Integer" override="false"/>, get the similar exception 
as before.

Is it possible to just provide the properties file path in server.xml or 
context.xml, so that tomcat would load it on startup? I have done this in JBoss 
using the  properties-service.xml file giving it the path to properties file 
which gets loaded on startup and the app can just reference those variables.

Thanks
An
 

Reply via email to