On Sat, Mar 5, 2016 at 5:22 PM, Christian Schuhegger < [email protected]> wrote:
> Hello, > > my question might be quite confused and my search results up to now did > not lead to any fruitful results. Perhaps the list can help me here? > > I want to use ApacheDS as the back-end for JNDI and I want to bind > resources to the standard names under java:comp/env, but currently am not > successful. > > I have set-up an Embedded ApacheDS 2.0.0-M21 instance following the > example here: > > http://svn.apache.org/viewvc/directory/sandbox/kayyagari/embedded-sample-trunk/src/main/java/org/apache/directory/seserver/EmbeddedADSVerTrunk.java?view=log > > I can connect to ApacheDS via the com.sun.jndi.ldap.LdapCtxFactory SPI. > > I only do not know how to bind resources to the standard java:comp/env > names. > > Is this possible and if yes, could somebody point me to a few sample code > lines? > > ApacheDS already supports such a feature see http://svn.apache.org/repos/asf/directory/apacheds/trunk/core-jndi for the context and other supported SPI implementations. I have never implemented one but I think you need to use the the ObjectFactory to write and read java objects. This works out of the box in JEE containers cause they already come with an ObjectFactory and also they map the "Java:/comp/env" namespace to a certain DN in the server behind the scenes. Perhaps the best is to take a look at how Tomcat does it and either adapt it directly or write your own based on it. HTH > Many thanks and best regards, > Christian > > Kiran Ayyagari
