tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Veniamin Fichin <3ca28...@mail.ru>
Subject Re: DataSourceRealm -- solved
Date Fri, 24 Jan 2003 09:43:40 GMT
Jacob Kjome wrote:

> You don't have to pur your <Resource> and <ResourceParam> tags in 
> <GlobalNamingResources> .  Just put them inside your <Context> take and 
> things will work fine.

    That's why I began this thread -- this configuration does not work.

...
<Context>
  <Resource />
  <ResourceParams>
...
  </ResourceParams>
  <Realm />
</Context>
...

    doesn't work, but

...
<GlobalNamingResource>
  <Resource />
  <ResourceParams>
...
  </ResourceParams>
</GlobalNamingResource>
...
<Context>
  <ResourceLink />
  <Realm />
</Context>

    works. And from exploring source code it looks like this.
    Method open:

--= [ cut ] =--
StandardServer server = (StandardServer) ServerFactory.getServer();
Context context = server.getGlobalNamingContext();
DataSource dataSource = (DataSource)context.lookup(dataSourceName);
return dataSource.getConnection();
--= [ / cut ] =--

    It's a global naming context that is searched for a JNDI name 
requested. Am I right?

> Jake
> 
> At 07:01 PM 1/23/2003 +0300, you wrote:
> 
>> Hello list!
>>
>>    Recently I posted a question about how to make DataSourceRealm 
>> work. After waiting for an answer here and in tomcat-dev list, I've 
>> finally gone it. So for those who want to use it, here are my steps.
>>    Configure server.xml to have <Resource ...> and <ResourceParams 
>> ...> in <GlobalNamingResource> tag. Have a link to this resource using 
>> <ResourceLink ...> inside your Context. And configute <Realm ...> 
>> referencing to corresponding DataSource JNDI name (use absolute 
>> reference, i.e. starting with java:/comp/env , not relative like 
>> jdbc/something). Example server.xml and web.xml are in attach. If 
>> anybody will see any errors in these files, I'd be happy to hear them.
>>    Though I have one question. What if I don't want to have <Resource 
>> ...> defined in global area? For example, I have several Contexts and 
>> want to use this resource in one of them only. Will ResourceLink's 
>> existance in one Context be the guarantee that only this Context will 
>> have an access to Resource, but not the others?

--= [ cut ] =--

-- 
Veniamin Fichin  <3ca28f66@mail.ru>
Programmer at    http://www.rbcsoft.ru/


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


Mime
View raw message