You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by si...@freilichs.org on 2003/03/14 21:50:50 UTC

NameNotFoundException with DataSourceRealm

I've made my own realm which uses DataSource, based on the DataSourceRealm
code, and dealt with the

            javax.naming.NameNotFoundException: Name java: is not bound in
this Context

problem. In addition to removing the connection check from the start method,
I also changed these lines in open():

            StandardServer server = (StandardServer)
ServerFactory.getServer();
            Context context = server.getGlobalNamingContext();

to:

           Context context = new InitialContext();



I think this is what allowed me to put my realm and datasource within the
context of my webapp, rather than in GlobalNamingResources.  This seems like
a worthwhile change to me. On the other hand, the InitialContext class is
imported, but not used, in DataSourceRealm - so, maybe my way had problems
in the past that were corrected with the getGlobalNamingContext() approach.



All this relates to this bug:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16316

And these comments:

------- Additional Comments From Glenn Nielsen 2003-02-03 22:05 -------

Try configuring your JNDI Named DataSource which is used
by the DataSourceRealm in the
GlobalNamingResources section of your server.xml config.


------- Additional Comments From Veniamin Fichin 2003-02-04 12:43 -------

Yes, it works now, but it's not good to have one DataSource for Realm
authentication only, useless waste of resources I think, if users
authentication
occurs rarely, as in my case.
I agree, this is a good workaround, but should I leave this bug REOPENED? (I
think so.)


------- Additional Comments From Glenn Nielsen 2003-02-04 13:25 -------

I have committed a patch to CVS which removes the validation of the db
connection for the JNDI named DataSource from the start code for the
realm so that the realm can start if the DataSource has not been setup yet.
Bug fix will be available in the next Tomcat 4.1 release.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org