So is there a way to access my own realm implementation from Servlet ?


-----Original Message-----
From: Glenn Nielsen [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 11, 2003 13:26 
To: Tomcat Developers List
Subject: Re: Accessing DataSourceRealm from servlet

The DataSourceRealm uses a JNDI named JDBC DataSource, it is not a
JNDI named resource itself.

Glenn

Uros Kotnik wrote:
> Hi,
> 
> I implemented my own class for user authentication based on RealmBase
> class, basicaly it's DataSourceRealm class just changed to my needs
> (added some methods like getUserRealName() etc.)
> So the class is
> 
> public class MyDataSourceRealm
>     extends RealmBase {.
> 
> I put jar with my class  in tc_home/server/lib, defined it in
> server.xml. And everything is working OK.
> 
> Only problem that I have is that I can't access that class from
servlet
> and use some of my added methods, like this:
> 
>       try{
>         Context ctx = new InitialContext();
>         MyDataSourceRealm um =
> (MyDataSourceRealm)ctx.lookup("java:comp/myDataSourceRealm");
>         String sFullName = um.getFullName(req.getRemoteUser());
>       }
>       catch(NamingException e){
>         System.out.println(e.toString());       
>       }
> 
> I get :
> 
> javax.naming.NameNotFoundException: Name myDataSourceRealm is not
bound
> in this
> Context
> 
> So, how I can gain access to myDataSourceRealm ?
> 
> 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]

Reply via email to