tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "GB Developer" <gb107...@globallyboundless.com>
Subject RE: Trouble finding Datsource Resource with DataSourceRealm
Date Thu, 20 Oct 2005 19:08:27 GMT
well, I couldn't get a Realm to function when the DataSource it needed was
defined in the same Context as the Realm itself. 

I've made it work by declaring the datasource resource in the 'global naming
resources' section of server.xml, and the realm directly under the 'engine'
element. And then in my host, I use a resourcelink to reference (and rename)
the globalresource to what my application is expecting. 

still puzzled why I couldn't get the other setup to work. 


> -----Original Message-----
> From: GB Developer [mailto:gb1071nx@globallyboundless.com] 
> Sent: Thursday, October 20, 2005 9:56 AM
> To: 'Tomcat Users List'
> Subject: RE: Trouble finding Datsource Resource with DataSourceRealm
> 
> 
> I should have mentioned, I have a ContextListener that contains the
> following:
> 
> -----------------------------------------------------------
> initCtx = new InitialContext();
> envCtx  = (Context) initCtx.lookup("java:comp/env");
> 
> logger.info("*** loading Data Source");
> try {
> 	ds = (DataSource) envCtx.lookup("sql/DataSource");
> 	application.setAttribute("services.datasource", ds);
> 	logger.info("*** DataSource loaded @ services.datasource");
> } catch (NamingException ne) {
> 	logger.fatal("ERROR loading DataSource: ", ne);
> }
> -----------------------------------------------------------
> 
> And I get both 'info' messages.  So the DataSource resource 
> is being loaded,
> and it *can* be found at "sql/DataSource" (by my code in the context
> listener).  It's just the Realm that can't seem to find it, 
> as indicated by
> the stacktrace below.
> 
> However, leaving no stone un-turned, I deleted the entire 
> work directory for
> the 'foo' host and get the same result. 
> 
> 
> This still appears in the engine log when I attempt to authenticate: 
> 
> 2005-10-20 09:51:15 DataSourceRealm[]: Exception performing 
> authentication
> javax.naming.NameNotFoundException: Name sql is not bound in 
> this Context
>   at org.apache.naming.NamingContext.lookup(NamingContext.java:768)
>   at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
>   at
> org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm
> .java:437)
>   at
> org.apache.catalina.realm.DataSourceRealm.authenticate(DataSou
> rceRealm.java:
> 277)
>   at
> org.apache.catalina.authenticator.BasicAuthenticator.authentic
> ate(BasicAuthe
> nticator.java:129)
> 
> 
> 
> > -----Original Message-----
> > From: Stanley Bradbury [mailto:Stan.Bradbury@gmail.com] 
> > Sent: Wednesday, October 19, 2005 8:07 PM
> > To: Tomcat Users List
> > Subject: Re: Trouble finding Datsource Resource with DataSourceRealm
> > 
> < big snip />
> 
> > >
> > Hi -
> > I had a similar problem (with 5.5.12) that turned out to be 
> > related to 
> > restart persistence (see post 10/17 Subj: "Odd problem with Restart 
> > Persistance..." for more info).  You can do a quick test by 
> > deleting the 
> > SESSIONS.ser file in ...work/Catalina/localhost/<myWebApp> 
> > (or whatever 
> > name and host relates to your installation) - start Tomcat 
> and see if 
> > the datasource is found.  If so, you will want to disable restart 
> > persistance for this App (see my note for more info).
> > 
> > Hope this Helps
> > 
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Mime
View raw message