Hi, I have some specific requirements for security and I have been trying to right a custom realm, that reads information from the database.
1. I have added a datasource in the global naming resources section in the server.xml 2. I have packaged the realm class in a JAR file and copied it the server lib 3. I have included a context.xml in the WAR META-INF, that declares the realm from (2) In the constructor of the realm class, I try to look up the datasource, 1. If I use new InitialContext().lookup, I get a name not found exception. 2. If I try to get the global naming context, by calling getServer from RealBase, getServer returns a null reference. This is the entry in server.xml <Resource name="MyDS" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" url="jdbc:oracle:thin:@10.211.55.7:1521:xe" username="meeraj" password="password" maxTotal="20" maxIdle="10" maxWaitMillis="-1" accessToUnderlyingConnectionAllowed="true"/> This is the entry in the context.xml <Realm className="com.ss.security.provider.DatabaseRealm" digest="SHA1"/> This is the constructor of the Realm class public DatabaseRealm() throws NamingException { Context context = null; try { context = new InitialContext(); template = new SimpleJdbcTemplate((DataSource) context.lookup("MyDS")); } finally { if (context != null) context.close(); } } Any pointers will be highly appreciated. Many thanks -- *Meeraj Kunnumpurath* *Director and Executive PrincipalService Symphony Ltd00 44 7702 693597mee...@servicesymphony.com <mee...@servicesymphony.com>*