tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <mdigg...@latte.harvard.edu>
Subject Re: Problems Instantiating JNDI LdapDirContext as resource.
Date Wed, 14 Jan 2004 01:00:55 GMT
Are the "parameter's" in ResourceParams also passed to the ObjectFactory 
via the environment Hashtable?

This may be where things are going wrong in my case?

Remy, your listed as an author on much of the Naming stuff, can you 
elaborate on this subject at all?

-Mark

Mark R. Diggory wrote:

> I've discovered a couple things I'm doing wrong:
> 
> 1.) the Resource type attribute was wrong.
> 2.) the ResourceParams factory should be the LdapCtxFactory.
> 
> Now what I'm getting back is a null object.
> 
> <Resource name="ldap/DirContext" auth="Container" 
> type="com.sun.jndi.ldap.LdapCtx"/>
> 
> <ResourceParams name="ldap/DirContext">
>     <parameter>
>         <name>factory</name>
>         <value>com.sun.jndi.ldap.LdapCtxFactory</value>
>     </parameter>
>     <parameter>
>         <name>java.naming.factory.initial</name>
>         <value>com.sun.jndi.ldap.LdapCtxFactory</value>
>     </parameter>
>     <parameter>
>         <name>java.naming.provider.url</name>
>         <value>ldap://localhost:389</value>
>     </parameter>
>     <parameter>
>         <name>java.naming.security.authentication</name>
>         <value>none</value>
>     </parameter>
>     <parameter>
>         <name>java.naming.referral</name>
>         <value>follow</value>
>     </parameter>
>      <parameter>
>         <name>java.naming.ldap.referral.limit</name>
>         <value>1</value>
>     </parameter>
> </ResourceParams>
> 
> Mark R. Diggory wrote:
> 
>> When I listBindings on "java:comp/env/ldap" and toString() the object 
>> returned, this is what I get back.
>>
>>
>> ResourceRef[className=com.sun.jndi.ldap.LdapCtxFactory,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shareable},{type=auth,content=Container},{type=java.naming.provider.url,content=ldap://localhost:389},{type=java.naming.factory.initial,content=com.sun.jndi.ldap.LdapCtxFactory},{type=java.naming.ldap.referral.limit,content=1},{type=java.naming.security.authentication,content=none},{type=java.naming.referral,content=follow}]

>>
>>
>>
>> Mark R. Diggory wrote:
>>
>>> I'm hoping to be able to build a Federated Namespace and be able to 
>>> access my ldap context in a federated fashion from the "java:comp" 
>>> context for instance "java:comp/env/ldap/ou=foo,o=bar".
>>>
>>>
>>> <Resource type="com.sun.jndi.ldap.LdapCtxFactory" auth="Container"
>>> name="ldap"/>
>>> <ResourceParams name="ldap">
>>>    <parameter>
>>>       <name>java.naming.factory.initial</name>
>>>       <value>com.sun.jndi.ldap.LdapCtxFactory</value>
>>>    </parameter>
>>>    <parameter>
>>>       <name>java.naming.provider.url</name>
>>>       <value>ldap://localhost:389</value>
>>>    </parameter>
>>>    <parameter>
>>>       <name>java.naming.security.authentication</name>
>>>       <value>none</value>
>>>    </parameter>
>>>    <parameter>
>>>       <name>java.naming.referral</name>
>>>       <value>follow</value>
>>>    </parameter>
>>>    <parameter>
>>>       <name>java.naming.ldap.referral.limit</name>
>>>       <value>1</value>
>>>    </parameter>
>>> </ResourceParams>
>>>
>>>
>>> If I understand correctly, all the ResourceParams will be handed to 
>>> the constructor of a LdapDirContext by the above Factory provided by 
>>> Sun and that I should be able to acquire this context simply with
>>>
>>> Context ctx = new InitialContext();
>>> DirContext ldap_ctx = (DirContext) ctx.lookup("java:comp/env/ldap");
>>>
>>> However, I consistently get:
>>>
>>> Message: Cannot create resource instance
>>> javax.naming.NamingException: Cannot create resource instance
>>>     at 
>>> org.apache.naming.factory.ResourceFactory.getObjectInstance(Unknown 
>>> Source)
>>>     at 
>>> javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:299)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.NamingContext.lookup(Unknown Source)
>>>     at org.apache.naming.SelectorContext.lookup(Unknown Source)
>>>     at javax.naming.InitialContext.lookup(InitialContext.java:345)
>>>
>>>
>>> Any help or comment would be greatly appreciated.
>>> -Mark
>>>
>>
> 

-- 
Mark Diggory
Software Developer
Harvard MIT Data Center
http://osprey.hmdc.harvard.edu

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


Mime
View raw message