From dev-return-27647-apmail-directory-dev-archive=directory.apache.org@directory.apache.org Sat Oct 04 22:14:30 2008 Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 81242 invoked from network); 4 Oct 2008 22:14:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Oct 2008 22:14:27 -0000 Received: (qmail 87808 invoked by uid 500); 4 Oct 2008 22:14:26 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 87776 invoked by uid 500); 4 Oct 2008 22:14:26 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 87765 invoked by uid 99); 4 Oct 2008 22:14:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Oct 2008 15:14:26 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of elecharny@gmail.com designates 72.14.220.159 as permitted sender) Received: from [72.14.220.159] (HELO fg-out-1718.google.com) (72.14.220.159) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Oct 2008 22:13:22 +0000 Received: by fg-out-1718.google.com with SMTP id 13so2056073fge.3 for ; Sat, 04 Oct 2008 15:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding:from; bh=BkAGCHaMRriYDy9ep1sAKcG4QdgniFDqbAlD+yPvpw8=; b=M+U6inTGtrIenn7YtQEz5MorHS0W3O6ovYpa0dx6KEx3SDLqGa5sYKWMmBLpIWu6gO omQSRXfVOHiXpoLUmGHbtdVi7BPceHHu8l7ttdFmhXJiIQFyxefGzaayG5AGDXHQBrol G/nStAb8/WsqyoKKKjpk3R04bJh1Q1nBEXC+s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding:from; b=djgspf6KcmJGm56M32fMYQ7DS/GQAJ5oYCN1TFZLqz80lgvkpy8aFjB7vRfCR4o2/n O9vzouM7m9h+pmRX59JA41KU3WwpqchD7v1y3RhaL9hh6ei+QRftphjuWciqlipfsxB1 XqDyUl5MbaXgPuyaLWnJRkYApFFx3ighmubmo= Received: by 10.86.68.1 with SMTP id q1mr2656102fga.2.1223158435692; Sat, 04 Oct 2008 15:13:55 -0700 (PDT) Received: from ?192.168.0.11? (vol75-3-82-66-216-176.fbx.proxad.net [82.66.216.176]) by mx.google.com with ESMTPS id d4sm8658980fga.5.2008.10.04.15.13.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 04 Oct 2008 15:13:54 -0700 (PDT) Message-ID: <48E7EAA0.3060502@nextury.com> Date: Sun, 05 Oct 2008 00:13:52 +0200 User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: Connecting the embedded way via JNDI: Cannot find directory service in environment References: <48E7E710.4030905@labeo.de> In-Reply-To: <48E7E710.4030905@labeo.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit From: Emmanuel Lecharny X-Virus-Checked: Checked by ClamAV on apache.org Stefan Zoerner wrote: > Hi all, > > currently I try to update the example on how to embedd ApacheDS in a > WebApp > > http://directory.apache.org/apacheds/1.5/embedding-apacheds-as-a-web-application.html > > > in order to let it work with ApacheDS 1.5.4. The API has been changed > since 1.5.1 (for which the example has been created for), hence the > source code examples do not work anymore. > > My web app is already able to start and stop a 1.5.4 ApacheDS server > via a ServletContextListener. > > Now I have a question regarding an embedded client. In the example, a > servlet connects to the server without wire protocol (embedded). It > uses JNDI for that. The old cfg does not seem to work. An env like this > > --- > > Hashtable env = new Hashtable(); > env.put(Context.PROVIDER_URL, ""); > env.put(Context.INITIAL_CONTEXT_FACTORY, > CoreContextFactory.class.getName() ); > env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system"); > env.put(Context.SECURITY_CREDENTIALS, "secret"); > env.put(Context.SECURITY_AUTHENTICATION, "simple"); > > --- > > causes an error, if the InitialContext is created: > > javax.naming.ConfigurationException: Cannot find directory service in > environment: > {java.naming.factory.initial=org.apache.directory.server.core.jndi.CoreContextFactory, > java.naming.provider.url=, > java.naming.factory.url.pkgs=org.apache.naming, > java.naming.security.authentication=simple, > java.naming.security.principal=uid=admin,ou=system, > java.naming.security.credentials=[B@1b6634c} > > --- > > It seems that I have to do something like this: > > env.put( DirectoryService.JNDI_KEY, directoryService ); yes, this is it. > > as in AbstractServerTest. Is this right? In this case, I have to > remember the DirectoryService instance somewhere. Solvable, but the > old way was easier ... The problem is that the DirectoryService is not known by the JNDI layer at this point. I don't exactly remember how it was before, maybe Alex can give you some good reason why it's not any more the case. Maybe we have to come back to the previous version... -- -- cordialement, regards, Emmanuel Lécharny www.iktek.com directory.apache.org