Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 781B12984 for ; Wed, 27 Apr 2011 15:17:42 +0000 (UTC) Received: (qmail 12194 invoked by uid 500); 27 Apr 2011 15:17:41 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 12121 invoked by uid 500); 27 Apr 2011 15:17:41 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 12112 invoked by uid 99); 27 Apr 2011 15:17:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2011 15:17:41 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2011 15:17:36 +0000 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1QF6UN-0002lX-UM for dev@tomcat.apache.org; Wed, 27 Apr 2011 08:17:15 -0700 Message-ID: <31488352.post@talk.nabble.com> Date: Wed, 27 Apr 2011 08:17:15 -0700 (PDT) From: Kornmod To: dev@tomcat.apache.org Subject: Re: JNDI, resource and LDAP Trouble In-Reply-To: <4DB82F33.2060407@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: poul@kornmod.dk References: <31488050.post@talk.nabble.com> <4DB82F33.2060407@apache.org> Sorry - I was too fast with the mouse not verifying that I was in the correct group. /Poul markt-2 wrote: > > On 27/04/2011 15:42, Kornmod wrote: >> >> Hi, >> >> I'm trying to create a simple resource for my web-app. My web-app has to >> connect to a ldap server to maintain users. I have created a context.xml >> in >> my META-INF folder - with the following content: > > This question belongs on the users mailing list, not the dev list. > > Mark > >> >> >> >> > auth="Container" >> type="com.sun.jndi.ldap.LdapCtx" >> factory="com.sun.jndi.ldap.LdapCtxFactory" >> java.naming.factory.initial="com.sun.jndi.ldap.LdapCtxFactory" >> com.sun.jndi.ldap.connect.pool="true" >> java.naming.provider.url="ldap://192.168.7.1:389/dc=blah,dc=com" >> java.naming.security.authentication="simple" >> java.naming.security.principal="cn=blah" >> java.naming.security.credentials="blahblah"/> >> >> >> >> But when I try to access my resource with the following code: >> >> Context newCtx = null; >> try { >> newCtx = new InitialContext(); >> } catch (NamingException e) { >> // TODO Auto-generated catch block >> e.printStackTrace(); >> } >> >> try { >> DirContext ctx = (DirContext) newCtx.lookup("blah"); >> if (ctx != null){ >> System.out.println ("Success"); >> } else { >> System.out.println ("False"); >> } >> >> it excepts with the following error: >> >> javax.naming.NameNotFoundException: Name blah is not bound in this >> Context >> >> I must be missing something essential - or doing something obviously >> wrong. >> But I seem not to be able to crack the nut myself. All help or input is >> much >> appreciated. >> >> NOTE: I have also tried to move the Resource config to >> CATALINA/conf/server.xml as a GlobalNamingResource with no luck. The >> classes >> in play obviously is in my CLASSPATH since they are part of my JDK/JRE >> (rt.jar). I'm using windows 7 with tomcat 7.0.12 and java 1.6.0.24. >> >> Brgds >> >> /Poul > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org > For additional commands, e-mail: dev-help@tomcat.apache.org > > > -- View this message in context: http://old.nabble.com/JNDI%2C-resource-and-LDAP-Trouble-tp31488050p31488352.html Sent from the Tomcat - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org