cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raj Basavaraju <...@bidland.com>
Subject Re: Trying to get LDAP "Hello World" to work
Date Thu, 02 Mar 2000 21:48:09 GMT
"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

Mime
View raw message