directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vitali Baumtrok <viba0...@stud.fh-kl.de>
Subject Cannot execute stored procedure or how to enable stored procedures
Date Fri, 17 Feb 2012 12:09:07 GMT
Hello guys,

I'm having some trouble with executing a stored procedure.

System:
WindowsXP
ApacheDS 2.0.0-M5
Apache LDAP API 1.0.0-M10
jdk 7

I have ApacheDS installed with all default preferences and the server is  
running as a service. I create "ou=Stored Procedure,ou=system" with Apache  
Directory Studio and try to execute the code:

private static void testStoredProcedure()
{
     final Hashtable<String, String> env = new Hashtable<String, String>();
     env.put(Context.INITIAL_CONTEXT_FACTORY,  
"com.sun.jndi.ldap.LdapCtxFactory");
     env.put(Context.PROVIDER_URL, "ldap://localhost:10389/ou=system");
     env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
     env.put(Context.SECURITY_CREDENTIALS, "secret");
     env.put(Context.SECURITY_AUTHENTICATION, "simple");

     try
     {
         final LdapContext ctx = new InitialLdapContext(env, null);

         final LdapContext spCtx = (LdapContext)ctx.lookup("ou=Stored  
Procedures");
         JavaStoredProcUtils.loadStoredProcedureClass(spCtx, Greeter.class);

         final String spName = Greeter.class.getName()+".helloWorld";
         final Object[] arguments = new Object[]{};
         JavaStoredProcUtils.callStoredProcedure(ctx, spName, arguments);
     } catch(NamingException e)
     {
         e.printStackTrace();
     }
}

Then I get the following exception:

javax.naming.NamingException [Root exception is  
java.lang.NullPointerException]
     at  
org.apache.directory.shared.ldap.sp.JavaStoredProcUtils.callStoredProcedure(JavaStoredProcUtils.java:168)
     at vb.App.testStoredProcedure2(App.java:69)
     at vb.App.main(App.java:48)
Caused by: java.lang.NullPointerException
     at  
org.apache.directory.shared.ldap.codec.standalone.StandaloneLdapApiService.toJndi(StandaloneLdapApiService.java:604)
     at  
org.apache.directory.shared.ldap.sp.JavaStoredProcUtils.callStoredProcedure(JavaStoredProcUtils.java:157)
     ... 2 more

Besides the Greeter.class is loaded successfully and I can see it in  
Apache Directory Studio. It's just I can't execute it.

By using the debuger I found out that the call of
System.getProperty( DEFAULT_EXTENDED_OPERATION_REQUESTS_LIST )
in
org.apache.directory.shared.ldap.codec.standalone.StandaloneLdapApiService.loadDefaultExtendedOperationRequests()
returns an empty String preventing the private field extReqFactories to be  
initialized. So I don't get an ExtendedRequestFactory while the  
.toJndi(...) method.

What does that mean? How do I make the needed properties available? Or is  
something wrong with the code?

Thanks for answers in advance

Mime
View raw message