Return-Path: Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-users@xml.apache.org Received: (qmail 85659 invoked from network); 2 Mar 2000 21:49:59 -0000 Received: from neutron.bidland.com (208.146.222.225) by locus.apache.org with SMTP; 2 Mar 2000 21:49:59 -0000 Received: from bidland.com (dt0f5n5c.san.rr.com [24.94.23.92]) by neutron.bidland.com (8.9.3/8.9.3) with ESMTP id NAA25256 for ; Thu, 2 Mar 2000 13:49:58 -0800 (PST) Message-ID: <38BEE198.9166C42D@bidland.com> Date: Thu, 02 Mar 2000 13:48:09 -0800 From: Raj Basavaraju X-Mailer: Mozilla 4.72 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: cocoon-users@xml.apache.org Subject: Re: Trying to get LDAP "Hello World" to work References: <1161B9F1E3E5D111A25700A02461F2AB02B37EBA@usrymx04.merck.com> Content-Type: multipart/alternative; boundary="------------D5004A2DC47E6C7159531317" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N --------------D5004A2DC47E6C7159531317 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Williams, Murray Todd" wrote: > Oh, I've got all those in the classpath. Besides, it's a > NullPointerException not a class not found exception, etc. It looks (by the > code snippet at the bottom of this message) like the problem has something > to do with the reading of attributes. I'm wondering if there is anything I > might be missing from the XML code itself. > > Murray I couldn't find anything wrong with your xml code. However, below is an example I found on the web sometime ago, seem to have worked on my system. Give a try and see whether it works for you. Raj :::::::::::::: ldap-new.xml :::::::::::::: com.sun.jndi.ldap.LdapCtxFactory ldap://tecfa2.unige.ch:389 givenname=Daniel :::::::::::::: ldap-new.xsl :::::::::::::: type="text/html" LDAP Search Results

Common Name Org Tel (work) # Secure # E-mail mailto:

> -----Original Message----- > From: Raj Basavaraju [mailto:raj@bidland.com] > Sent: Thursday, March 02, 2000 4:25 PM > To: cocoon-users@xml.apache.org; murray_williams@merck.com > Subject: Re: Trying to get LDAP "Hello World" to work > > In order to get ldap sample to properly, make sure jndi.jar and > providerutil.jar > > files are visible in wrapper.classpath. If you don't have these jar files > download them from javasoft web site. > > Raj > > "Williams, Murray Todd" wrote: > > > I had incredible luck getting the SQL Processor. I think I must have > spent > > all my karma in one shot. I'm trying to get an LDAP example going now and > > I'm getting a NullPointerException. Unfortunately, I know very little > about > > LDAP (I'm trying to learn now) so I'm a bit lost in the lingo. The > > stacktrace I'm getting follows: > > > > java.lang.NullPointerException > > at > > > org.apache.cocoon.processor.ldap.LdapProcessor.process(LdapProcessor.java:11 > > 6) > > at org.apache.cocoon.Engine.handle(Engine.java:283) > > at org.apache.cocoon.Cocoon.service(Cocoon.java:145) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:309) > > at > > org.apache.jserv.JServConnection.processRequest(JServConnection.java:314) > > at org.apache.jserv.JServConnection.run(JServConnection.java:188) > > at java.lang.Thread.run(Thread.java:479) > > > > The .xml file is very very simple (based on the example in the > > documentation)... > > > > > > > > > > > > > > > > > > > > > > > > > > com.sun.jndi.ldap.LdapCtxFactory > > ldap://usrymx04.merck.com > > > > > > > > > > sn=*madhukar* > > > > > > > > > > And just to save some time, the line where the NullPointerException is > > coming from is the last line (query_props.put(...)) in the following code > > snippet. > > > > NamedNodeMap query_attributes = query_element.getAttributes(); > > for (int j=0; j > Node query_attribute = query_attributes.item(j); > > > > > query_props.put(query_attribute.getNodeName(),query_attribute.getNodeValue() > > ); > > } > > > > Would anyone be able to tell off the bat what I'm doing wrong? Thanks a > > billion! > > > > Murray Todd Williams > > Merck & Co., Inc. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > > For additional commands, e-mail: cocoon-users-help@xml.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > For additional commands, e-mail: cocoon-users-help@xml.apache.org --------------D5004A2DC47E6C7159531317 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit "Williams, Murray Todd" wrote:
Oh, I've got all those in the classpath.  Besides, it's a
NullPointerException not a class not found exception, etc.  It looks (by the
code snippet at the bottom of this message) like the problem has something
to do with the reading of attributes.  I'm wondering if there is anything I
might be missing from the XML code itself.

Murray

I couldn't find anything wrong with your xml code.  However, below is an example I found on the web sometime ago, seem to have worked on my system.  Give a try and see whether it works for you.

Raj

::::::::::::::
ldap-new.xml
::::::::::::::
<?xml version="1.0"?>
<?xml-stylesheet href="ldap-new.xsl" type="text/xsl"?>
<?cocoon-process type="ldap"?>
<?cocoon-process type="xslt"?>

<page>

  <ldap-defs>
    <ldap-server name="tecfa">
      <initializer>com.sun.jndi.ldap.LdapCtxFactory</initializer>
      <ldap-serverurl>ldap://tecfa2.unige.ch:389</ldap-serverurl>
    </ldap-server>
    <ldap-querydefs name="standard" default="yes"/>
  </ldap-defs>

  <ldap-query server="tecfa" ldap-searchbase="o=tecfa.unige.ch" defs="standard">
     givenname=Daniel
  </ldap-query>

</page>

::::::::::::::
ldap-new.xsl
::::::::::::::
<?xml version="1.0"?>

<!-- <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"> -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="page">
   <xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
   <html>
    <head>
     <title>
      LDAP Search Results
     </title>
    </head>
    <body bgcolor="#ffffff">
     <xsl:apply-templates/>
    </body>
   </html>
  </xsl:template>

 <xsl:template match="searchresult">
        <table cellspacing="0" cellpadding="6">
     <xsl:apply-templates select="cn"/>
     <xsl:apply-templates select="currentorganization"/>
     <xsl:apply-templates select="mail"/>
     <xsl:apply-templates select="telephonenumber"/>
     <xsl:apply-templates select="securephonenumber"/>
        </table>
        <p/>
  </xsl:template>
 
 <xsl:template match="cn">
        <tr>
         <th bgcolor="tan" align="right">Common Name</th>
         <td>
      <xsl:apply-templates/>
         </td>
        </tr>
  </xsl:template>

 <xsl:template match="currentorganization">
        <tr>
         <th bgcolor="tan" align="right">Org</th>
         <td>
      <xsl:apply-templates/>
         </td>
        </tr>
  </xsl:template>

 <xsl:template match="telephonenumber">
        <tr>
         <th bgcolor="tan" align="right">Tel (work) #</th>
         <td>
      <xsl:apply-templates/>
         </td>
        </tr>
  </xsl:template>

 <xsl:template match="securephonenumber">
        <tr>
         <th bgcolor="tan" align="right">Secure #</th>
         <td>
      <xsl:apply-templates/>
         </td>
        </tr>
  </xsl:template>

 <xsl:template match="mail">
        <tr>
         <th bgcolor="tan" align="right">E-mail</th>
         <td>
      <a>
           <xsl:attribute name="href">
        mailto:<xsl:apply-templates/>
           </xsl:attribute>
       <xsl:apply-templates/>
          </a>
         </td>
        </tr>
  </xsl:template>

 <xsl:template match="comment">
<p>
      <xsl:apply-templates/>
</p>
  </xsl:template>

</xsl:stylesheet>
 

 -----Original Message-----
From:   Raj Basavaraju [mailto:raj@bidland.com]
Sent:   Thursday, March 02, 2000 4:25 PM
To:     cocoon-users@xml.apache.org; murray_williams@merck.com
Subject:        Re: Trying to get LDAP "Hello World" to work

In order to get ldap sample to properly, make sure jndi.jar and
providerutil.jar

files are visible in wrapper.classpath.  If you don't have these jar files
download them from javasoft web site.

Raj

"Williams, Murray Todd" wrote:

> I had incredible luck getting the SQL Processor.  I think I must have
spent
> all my karma in one shot.  I'm trying to get an LDAP example going now and
> I'm getting a NullPointerException.  Unfortunately, I know very little
about
> LDAP (I'm trying to learn now) so I'm a bit lost in the lingo.  The
> stacktrace I'm getting follows:
>
> java.lang.NullPointerException
>      at
>
org.apache.cocoon.processor.ldap.LdapProcessor.process(LdapProcessor.java:11
> 6)
>      at org.apache.cocoon.Engine.handle(Engine.java:283)
>      at org.apache.cocoon.Cocoon.service(Cocoon.java:145)
>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
>      at
> org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
>      at org.apache.jserv.JServConnection.run(JServConnection.java:188)
>      at java.lang.Thread.run(Thread.java:479)
>
> The .xml file is very very simple (based on the example in the
> documentation)...
>
> <?xml version="1.0"?>
> <?cocoon-process type="ldap"?>
> <?cocoon-process type="xslt"?>
> <?cocoon-format type="text/xml"?>
>
> <?xml-stylesheet href="ldapExample.xsl" type="text/xsl"?>
>
> <page title="LDAP Processor Example">
>
> <ldap-defs>
>    <ldap-server name="usrymx04">
>      <initializer>com.sun.jndi.ldap.LdapCtxFactory</initializer>
>      <ldap-serverurl>ldap://usrymx04.merck.com</ldap-serverurl>
>    </ldap-server>
> </ldap-defs>
>
> <ldap-query server="usrymx04">
>  sn=*madhukar*
> </ldap-query>
>
> </page>
>
> And just to save some time, the line where the NullPointerException is
> coming from is the last line (query_props.put(...)) in the following code
> snippet.
>
> NamedNodeMap query_attributes = query_element.getAttributes();
> for (int j=0; j<query_attributes.getLength(); j++) {
>   Node query_attribute = query_attributes.item(j);
>
>
query_props.put(query_attribute.getNodeName(),query_attribute.getNodeValue()
> );
> }
>
> Would anyone be able to tell off the bat what I'm doing wrong?  Thanks a
> billion!
>
> Murray Todd Williams
> Merck & Co., Inc.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org

--------------D5004A2DC47E6C7159531317--