Hi, This is an excerpt of my code, to get a Context. Try and see if it works for you. 31 private void initDataSource () { 32 try { 33 Context initCtx = new InitialContext(); 34 Context envCtx = (Context) initCtx.lookup("java:comp/env"); 35 dataSource = (DataSource) envCtx.lookup("jdbc/Taglib"); 36 } 37 catch (NamingException e) { 38 System.out.println("ERR: Unable to Initialize Data Source (" + e + ")"); 39 } 40 }
Configs of web.xml is similar to yours. However am not sure if you need an additional parameter to <web-app> like so: 8 <context-param> 9 <param-name>dataSource</param-name> 10 <param-value>jdbc/Taglib</param-value> 11 </context-param> Check the dtd description at http://java.sun.com/j2ee/dtds/web-app_2.3.dtd for further info. aka_sergio --- Dan Washusen <[EMAIL PROTECTED]> wrote: > Hi All, > I'm trying to get container managed authentication > going under Tomcat > 5.5 using the > org.apache.catalina.realm.DataSourceRealm class. > I've > configured a DataSource using the name "jdbc/MindDB" > and I can access > that from within my app, but when the configured > DataSourceRealm tries > to access it I get > "javax.naming.NameNotFoundException: Name jdbc is > not bound in this Context". > > My context.xml looks like this: > <Context path="/mind" > > docBase="D:/Development/Projects/mind/src/webapp" > debug="5" reloadable="true"> > <Resource name="jdbc/MindDB" auth="Container" > type="javax.sql.DataSource" > maxActive="100" maxIdle="30" maxWait="10000" > username="mind" password="********" > driverClassName="org.postgresql.Driver" > url="jdbc:postgresql://localhost/mind"/> > > <Realm > className="org.apache.catalina.realm.DataSourceRealm" > debug="99" > dataSourceName="jdbc/MindDB" > userTable="mind_user" userNameCol="alias" > userCredCol="password" > userRoleTable="mind_user_role" > roleNameCol="name"/> > </Context> > > And the relevant section of my web.xml looks like > this: > ... > <resource-ref> > <description>Mind DB > Connection</description> > <res-ref-name>jdbc/MindDB</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > ... > > I've also tried using the full name of > "java:/comp/env/jdbc/MindDB" > that works in my code but that just changes my error > to > "javax.naming.NameNotFoundException: Name java: is > not bound in this > Context". > > Any help would be greatly appreciated... > > Cheers, > Dan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]