If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
katrinaniolet
Posts: 23
Registered: ‎07-26-2008
My Device: Not Specified

LDAP in Simulator not working?

JDE 4.5.0

Simulator: 8300, 4.5.0.44

MDS-CS is running and seems to be working (external web pages are accessible)

 

I am trying to query a standard plain ol' nothing special anonymous login LDAP server using net.rim.device.api.ldap.LDAPQuery, but I keep ending up with net.rim.device.api.ldap.LDAPQuery.LDAP_ERROR_SERVICE_UNAVAILABLE_EXCEPTION

 

The documentation doesn't give any specifics about what the error message actually means or where it comes from. 

 

The host name and port are correct, I can access the LDAP service through several other applications (on my desktop) just fine. From what I can tell, the simulator is not even attempting to actually connect to the LDAP server. (There doesn't seem to be anything about it in the MDS logs and application.handler.ldap.logging is set to 'true' in the rimpublic.property configuration file.

 

Anyone have any ideas? 

Please use plain text.
New Developer
katrinaniolet
Posts: 23
Registered: ‎07-26-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

Oh, also LDAPQuery.getErrorMsg() is returning null (even though LDAPQuery.getErrorCode() returns LDAP_ERROR_SERVICE_UNAVAILABLE_EXCEPTION)
Please use plain text.
New Developer
katrinaniolet
Posts: 23
Registered: ‎07-26-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

Here is some code: 
 

LDAPQuery query = new LDAPQuery();

query.setHost("ldap.itd.umich.edu",389,"ou=Security,dc=umich,dc=edu");

query.setAuthType(LDAPQuery.LDAP_AUTH_ANONYMOUS);

query.setScope(LDAPQuery.LDAP_SCOPE_SUB);

query.addAttribute("cn");query.start();

Enumeration enum = query.getResults();

if (query.getErrorCode() != LDAPQuery.LDAP_SUCCESS) {

 it is always happening that query.getErrorCode() returns net.rim.device.api.ldap.LDAPQuery.LDAP_ERROR_SERVICE_UNAVAILABLE_EXCEPTION

Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: LDAP in Simulator not working?

Please enter your LDAP information in the rimpublic.property file for the MDS Simulator.  It is located in the (install directory)\MDS\config directory.

 

Does the same query execute in your environment using the Microsoft LDP Support Tool Utility?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
katrinaniolet
Posts: 23
Registered: ‎07-26-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

ok I changed that to:

 

[LDAP HANDLER]

application.handler.ldap.DEFAULT_SERVER = ldap.itd.umich.edu

application.handler.ldap.DEFAULT_PORT   = 389

application.handler.ldap.DEFAULT_QUERY  = ou=Security,dc=umich,dc=edu

application.handler.ldap.DEFAULT_LIMIT  = 20

application.handler.ldap.COMPRESSION    = false (note: i tried this set to true also)

application.handler.ldap.logging        = true

 

then restarted the MDS simulator, same problem. On a hunch, I changed the query up a bit to:

query.setHost("ldap.itd.umich.edu",389,"ou=Security,dc=umich,dc=edu");

query.setAuthType(LDAPQuery.LDAP_AUTH_ANONYMOUS);

query.setScope(LDAPQuery.LDAP_SCOPE_ONE);

query.addAttribute("cn");

query.addFilter("cn=*"); 

 

but still the same problem. I can query just fine from the MS LDP Support Tool.

 

Thanks for helping out with this :-) 

Please use plain text.
New Developer
katrinaniolet
Posts: 23
Registered: ‎07-26-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

BTW, I tried it in the 4.6.0.7 JDE using the included 9000 device simulator and MDS simulator with the same results.
Please use plain text.
New Developer
katrinaniolet
Posts: 23
Registered: ‎07-26-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

[ Edited ]

Maybe I'm just overlooking something... I'm normally a C++ developer rather than a J2ME developer so maybe there is some stupid mistake, here is a very small program I made just to test for this particular issue, am I just missing something?

 

 

package net.test.ldap;

 

import java.io.*;

import java.util.*;

import net.rim.device.api.ui.*;

import net.rim.device.api.ui.component.*;

import net.rim.device.api.ui.container.*;

import net.rim.device.api.system.*;

import net.rim.device.api.util.*;

import net.rim.device.api.ldap.*;

 

public final class RIMLDAPTest extends UiApplication

{

public static void main(String[] args)

{

new RIMLDAPTest().enterEventDispatcher();

}

public RIMLDAPTest()

{

LDAPQuery query = new LDAPQuery();

try {

query.setHost("ldap.itd.umich.edu",389,"ou=Security,dc=umich,dc=edu");

query.setAuthType(LDAPQuery.LDAP_AUTH_ANONYMOUS);

query.setScope(LDAPQuery.LDAP_SCOPE_ONE);

query.addAttribute("cn");

query.addFilter("cn=Postmaster");

query.start();

Enumeration enum = query.getResults();

if (query.getErrorCode() == LDAPQuery.LDAP_ERROR_SERVICE_UNAVAILABLE_EXCEPTION)

System.out.println(":-(");

else

System.out.println(":-D");

}

catch(Exception e) {

System.out.println(e.getMessage());

System.exit(1);

}

}

}

 

 

 

Message Edited by katrinaniolet on 07-29-2008 10:54 PM
Please use plain text.
New Developer
jrebeiro
Posts: 9
Registered: ‎09-13-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

Any solution to this issue? I am receiving the same error.

 

Editing rimpublic.property was not helpful and there is no evidence in the MDS simulator that the LDAP request is even made!

Please use plain text.
New Developer
katrinaniolet
Posts: 23
Registered: ‎07-26-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

Nope, I have not found a solution to this yet, as far as I can tell, this just doesn't work in the simulator :-(
Please use plain text.
New Developer
jrebeiro
Posts: 9
Registered: ‎09-13-2008
My Device: Not Specified

Re: LDAP in Simulator not working?

Does it work on the device? I haven't tried it yet.. and gave up on the app since I couldn't get it working in the simulator.
Please use plain text.