OK, I'm doing this:
I made class ------------- public class UserManager extends RealmBase It's almost same like DataSourceRealm just little changed to suit my DB. I deleted code parts from start() that validates that we can open our connection and also put this code part to public Principal authenticate(String username, String credentials) if (dbConnection == null) { return null; } This is where I get exception ----------------------------- private Connection open() { try { StandardServer server = (StandardServer) ServerFactory.getServer(); Context context = server.getGlobalNamingContext(); DataSource dataSource = (DataSource)context.lookup(dataSourceName); //exception here return dataSource.getConnection(); } catch (Exception e) { // Log the problem for posterity log(sm.getString("dataSourceRealm.exception"), e); } return null; } This is from the log: --------------------- 003-02-25 15:09:16 DataSourceRealm[]: Exception performing authentication javax.naming.NameNotFoundException: Name jdbc is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:811) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.asterius.tomcat.security.UserManager.open(UserManager.java:647) at org.asterius.tomcat.security.UserManager.authenticate(UserManager.java:4 80) at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAut henticator.java:263) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator Base.java:480) This is Server.xml ------------------ <Context debug="0" docBase="C:\Projects\ipcs\ipcs" path="" workDir="C:\Projects\ipcs\ipcs"> <Resource name="jdbc/hsqldb" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/hsqldb"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <!-- dB username and password for dB connections --> <parameter> <name>username</name> <value>iuser</value> </parameter> <parameter> <name>password</name> <value>iuser</value> </parameter> <!-- Class name for JDBC driver --> <parameter> <name>driverClassName</name> <value>org.hsqldb.jdbcDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:hsqldb:hsql://asterix</value> </parameter> </ResourceParams> <Realm className="org.asterius.tomcat.security.UserManager" debug="99" dataSourceName="jdbc/hsqldb" userTable="ic_users" userNameCol="login_name" userCredCol="password" userRoleTable="ic_groups" roleNameCol="group_name" linkUserRoleTable="ic_users_groups" groupIDcol="id_group" userIDcol="id_user" userIDlang = "id_language" userRealName="real_name" /> -----Original Message----- From: Glenn Nielsen [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 14:52 To: Tomcat Developers List Subject: Re: DataSource realm, apply fix for 16316 bug, still not working ? The code for DataSourceRealm defers obtaining the db connection from the JNDI named JDBC DataSource until it is used, after the context is started. What you are trying to do should work. Please post more information about your configuration and any stack traces or errors which get logged. Glenn Uros Kotnik wrote: > Hi, > > Applyed fix for bug 16316, DataSourceRealm can not find JNDI name in > context. > Before fix solution was to put JNDI Named DataSource which is used > by the DataSourceRealm in the GlobalNamingResources section of your > server.xml config and that worked. > I thought than now I can left JNDI Named DataSource from > GlobalNamingResources and put it in <Context> (or use JNDI Named > DataSource that I defined in context) but I still get " Name jdbc is not > bound in this Context". > > Thanx. > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]