Tomcat: parametrize context.xml ?

Alles, was den Apache betrifft, kann hier besprochen werden.

Tomcat: parametrize context.xml ?

Postby a808503 » 15. April 2011 14:08

I would like to use parameters in the context.xml of my web application. The parameters should be defined on the server

I have added the line

Code: Select all
DBVAL=mydb_dev   


to catalina.properties.

Now I define a Realm in my webabb's context.xml:
Code: Select all
<Realm className="org.apache.catalina.realm.JDBCRealm"   
                driverName="org.postgresql.Driver"   
                connectionURL="jdbc:postgresql://myserver:5432/${DBVAL}"   
                connectionName="xxx" connectionPassword="yyy"   
                userTable="users" userRoleTable="roles"   
                userNameCol="name" userCredCol="pw" roleNameCol="role"   
                digest="MD5" />   


However, in the logfiles I can find:
org.postgresql.util.PSQLException: FATAL: database "${DBVAL}" does not exist

It seems, that the parameter value was not replaced.

What I would like to have is to define a Realm once in context.xml, that will be used both on a development and on a productive server. The servers define the actual name of the database (here "mydb_dev"), e.g. in catalina.properties.
a808503
 
Posts: 1
Joined: 15. April 2011 14:04

Return to Apache

Who is online

Users browsing this forum: No registered users and 2 guests