Ldap search in jsp not working

Hi
We have users imported from db into oid and they have blank passwords. So for those users , when they first try to login, I am planning to take them to someother page. I have added code to login.jsp where in case of authentication error, I want to redirect users with blank password to a separate page. So I am doing a search for user in LDAP and trying to get user attributes. I am not getting any errors in my jsp , but somehow the search is not successful. Can someone tell me whats wrong with this code??
try
DirContext dirctx = null;
//Build the LDAP url
String ldapurl = "ldap://" + "stg.test.com" + ":" + "3060";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, ldapurl);
// if password is specified, set the credentials
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL,"orcladmin");
env.put(Context.SECURITY_CREDENTIALS,"welcome");
// Bind and initialize the Directory context
dirctx = new InitialDirContext(env);
Attributes matchAttrs = new BasicAttributes(true); // ignore attribute name case
     matchAttrs.put(new BasicAttribute("uid", str_user));
     // Search for objects with those matching attributes
     NamingEnumeration answer = dirctx.search("cn=Users,dc=oprah,dc=com", matchAttrs);
     //formatResults(answer);
     int count=0;
          while (answer.hasMore()) {
               SearchResult sr = (SearchResult)answer.next();
          out.println("SEARCH RESULT:" + sr.getName());
               Attributes attrs=sr.getAttributes();
               if (attrs == null) {
                    out.println("This result has no attributes");
                    } else {
                         for (NamingEnumeration enum = attrs.getAll(); enum.hasMore();) {
                         Attribute attrib = (Attribute)enum.next();
                         out.println("ATTRIBUTE :" + attrib.getID());
                         for (NamingEnumeration e = attrib.getAll();e.hasMore();)
                              out.println("\t\t = " + e.next());
               //formatAttributes(sr.getAttributes());
          out.println("====================================================");
               count++;
          out.println("Search returned "+ count+ " results");
     dirctx.close();
catch (Exception e)
e.printStackTrace();
}

I figured the problem. I need to give the dn of orcladmin here
env.put(Context.SECURITY_PRINCIPAL,"cn=orcladmin,cn=users,dc=test,dc=com");
instead of
(Context.SECURITY_PRINCIPAL,"orcladmin");

Similar Messages

  • With input disabled field search help is not working.

    Hi Web dynpro abap Gurus
    Please help me on below requirement.
    If i make a input field disable then the attach search help is not working. Is there is any way by which
    I can make input field disabled and search help will also work for this field.
    I really need help on this, Please help me.
    Many thanks in advance.
    Sandeep Sharma
    09971995045

    Hi
    I dont think that a field can be disabled and allows to choose data using f4 simultaneously. you can enable the field and allow the user to select whatever he/she wants.
    Then in any action like on press of save or submit button which the user will trigger after entering the values, get the value entered by the user in that perticular field and fire a query on the table/view, which you have used as selection method of your search help, it help is coming from data element then look for check table in domain. if sy-subrc comes 0 than go ahead else give error that value selected is modified.
    Thanks
    Vishal

  • Search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.

    search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.I have writen code on EH_ONSEARCH .as per below...what changess i need to do..and through partner function and adding the selection params please send the sample .
    code. partner funtction - ZRG DATA :
    DATA : lv_partner_fct type .
    types: begin of ty_resp,
           partner    type but000-partner,
           name_last  type but000-name_last,
           name_first type but000-name_first,
           mc_name1   type but000-mc_name1,
           mc_name2   type but000-mc_name2,
           end of ty_resp.
    DATA: lv_resp_bp type STANDARD TABLE OF ty_resp INITIAL SIZE 0,
           lw_resp_bp type ty_resp.
    IF lv_attr_name = 'Rgroup'.
    lr_entity->get_property_as_value( EXPORTING iv_attr_name = if_crm_srqm_uiu_const=>gc_attr_low
                                       IMPORTING ev_result = lv_low ).
    IF lv_low IS INITIAL.
    SELECT partner
           name_last
           name_first
           mc_name1
          mc_name2
    FROM but000 INTO table lv_resp_bp
    WHERE mc_name2 = lv_low and bu_group = '0010'.
    loop at lv_resp_bp into lw_resp_bp.
        lv_low = lw_resp_bp-mc_name2.
      lr_query_service2->add_selection_param( iv_attr_name = 'Rgroup'
                                                iv_sign = lv_sign
                                                iv_option = lv_option
                                                iv_low = lv_low
                                                iv_high = lv_high ).
      ENDLOOP.
    if lv_partner_fct = 'ZRG'.
      lr_entity = lr_iterator->get_next( ).
    CONTINUE.
    ENDIF.
    lv_attr_name = 'BU_PARTNER'.
    ENDIF.

    <b>You can acheive   this .... first by creating the search help exit    ... by  creating the maintaince  view   then   using it in the   Creation of the search help </b> ...
    see the link for attaching the view   to the serach help .
    <a href="http://">http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_elementary.htm</a>
    reward  points if it is usefull...
    Girish

  • Search Bar is not working for me in windows 7 32 bit OS

    Search Bar is not working for me in windows 7 32 bit OS'''bold text'''

    Hi Sameer,
    There's no version of Windows Vista that is supported, regardless of service packs.  You can always upgrade to Windows 7, though.
    Your other option is to use Brackets, the open source editor that Edge Code is based on.  It still supports Vista for now.  The downside is that Brackets lacks some features of Edge Code: Kuler integration, Edge Inspect integration, and Edge Web Fonts code hints -- although all of those except Kuler are offered as optional Brackets extensions too (you just have to install them).
    Hope that helps,
    - Peter

  • BUG in iOS7: Post iOS7 upgrade, search option does not work for "Messages". If you want to search a contact name in Messages who is way below the list, the search will not yield any result.

    BUG in iOS7: Post iOS7 upgrade, search option does not work for "Messages". If you want to search a contact name in Messages who is way below the list, the search will not yield any result.

    These are user forums. You are not speaking to Apple here. Report your problem at Apple Feedback.

  • My search function does not work. How can I fix it?

    Hello
    I need help I just bough a macbook 13 inch, with snow leopard
    and the search function does not work.
    The window opens but when I write the name i searh it gives me no results.
    How can i fix it?
    Do i need really to re install all snow leopard?
    thanks
    pt

    Hello paola t & welcome to the forums
    I need help I just bough a macbook 13 inch
    It may be that Spotlight hasn't completed indexing just yet - is there a dot (indicates busy) inside the magnifying icon top right?
    Also, check System Preferences/Spotlight to see what if any exclusions are configured, etc.

  • Mail search function does not work after reinstalling

    Hello!
    I recently had to re-install Leopard on my MacBook Pro.
    I made a clean install so, I manually copied the Mail folder and preferences from my old home folder to the new one.
    All mails are present, and everything works great, apart from the fact that the search function does not work.
    I can search for new mails (that came after the reinstall) but the old ones "dont exist" as far as the mail.app goes.
    What can I do about it ?

    It would probably be easier to do the entire hard drive. The App Store also uses Spotlight, so updating it will help there also. It takes some time to re-index and your computer will/may run slower until it is done.
    Direct answer to your question is go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J.  When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder. Then go to System Preferences/Spotlight per the linked article and in your user folder, select Library/Mail/V2.
    Thanks to leonie for some information contained in this.

  • TOC, Search, Index does not work after hosting published files in Multiscreen HTML5

    I have generated and published the files for multiscreen html5. The default screen layout is Desktop_layout. When I access index.htm directly from the published location, every function and all details work beautifully. However, once I host the published files in IIS, and type the URL in Google Chrome, the screen layout is all messed up. TOC, Index, Glossary and the Search function does not work. Please help/suggest/guide.

    Could this be related to IIS? I host it locally on IIS (8.0 on Windows 8.1 Pro) and on Apache without any problems. But IIS can give trouble if the folder security options are not set correctly, so please make sure the IIS User has full read rights on all directories and files.
    Kind regards,
    Willam

  • HT4623 Since I installed the new update, my search feature will not work. It will only search my ipad. None of the searh engines work in Safari

    Since I installed the new operating System, my search feature does not work. I can only search my ipad. None of the search engines work in Safari. How do I fix it?

    Just just to make sure, you do not see something like this when you try to do a search in Safari?
    Try clearing Safari in Settings>Safari>Clear Cookies and data. Then close Safari. Double tap the home button and drag the mini Safari window up toward the top of the screen in the multitasking display in order to close the app. Now reboot the iPad. Hold down on the sleep and home buttons at the same time until the Apple Logo appears on the screen.
    Try Safari again.
    The Spotlight Search feature on the iPad search) no longer searches the web, that is simply the way that Spotlight works now. Sort of a backwards move IMO but somewhat typical of Apple these days.

  • Firefox 5 search bar does not work.

    I have downloaded firefox 5 and the search feature does not work.

    See:
    * http://kb.mozillazine.org/Unable_to_search_or_add_new_engines

  • Mac mail search function is not working. Any search term returns all records.

    Mac mail search function is not working. Any search term returns all records.

    hi eric. many thanks.
    i will have to read these links closer but what i meant to say is that the hard drive space that was being taken up seemed like it suddenly jumped way up because i had just gotten through a process in the last month where i am storing all my My Documents data on my Mac Pro. i am doing this in order to decide whether i should just keep it ALL on my Mac Pro and use ChronoSync to sync /some/ of it to my MBP.
    so if i look in the Documents folder on my Mac Pro i have a ton of folders that i have created with a ton of data. if i look in the Documents folder on my MBP there are NO folders that have data in them that i created. there are other folders such as folders that various software created but what i mean to point out is that there was a LOT of available space on my HD until recently.
    i am wondering if there is some way that running the Mail re-index (it then ran some kind of "Importing" routine) or by syncing my Photostream to the MBP caused a huge jump in data on this drive. if it is the photostream sync i can just take this off or see if it will sync more selectively. if it is something to do with mac mail jumping in size i am not sure why this would happen or what to do about it.
    does that question make sense?
    i mean, before i did these two operations my recollection is that i would have had 130 GB on the hard drive (really just guessing here) and now there is like 218 GB on the hard drive and i don't know where all this came from...

  • Catalog search tool is not working.

    Hi ,
    IN CCM catalog search tool. When i wrote some thing on the find field click on go button. Nothing will happen. It should search the products in the catalog ..can any one tell why search option is not working inthe catalog search tool...

    Hello,
    first delete system cache by going to ...
    tools -> internet options -> Delete files with offline content , delete cookies and clear history.
    If not working then contact basis ..delete the template and MIME cache in SRM thrugh SITSPMON and reactivate  all the internet servies  through SICF.
    Thanks
    Venkatesh.
    PS : please reward for helpful answer

  • My search engines do not work. I can access all my bookmarked items, but I cannot search for anything new. I followed all the troubleshooting steps I found but it did not work.

    My search engines do not work. I can access all my bookmarked items but I cannot perform any new searches. This problem has been happening since this morning. I followed all the troubleshooting steps that I could find and nothing has worked.

    Just to make sure, did you check the ring/silent button on the side of the phone? If it is set to "mute" you can still hear your selected ringtone in settings/sound, for example.

  • Mac Lion. Search function does not work in mails.

    Hello,
    I already wasted several hours trying to find solution for a problem which appeared with Lion, search function does not work, in mail at least.
    I was not using Leopard before and I am not a mac expert.
    (search function was already bad in the normal it was already bad in the normal 10.7 set up but at least it was working in mac mails).
    I tried reindexing via spotlight privacy settings (adding and removing HD) but does not work much better.
    I don't want to go to terminal, as as mentioned I don't know enough about mac to try this.
    What to do?
    Thanks,
    C.

    Anyone? Any ideas?

  • Search help is not working at Transaction Launcher

    Hi gurus,
    I create a transaction launch that calls a ZXXX t.code from same CRM system.
    T.code ZXXX is used to execute a custom report in order to create document from excel file.
    Everything is ok, but search help button is not working on web ui.
    Search help will open "my computer" pop up. I guess this cause problem. Is there anyone who met this problem before?
    Regards
    Sadi

    Hi,
    Is the search help button part of custom report and is it working fine in GUI ?
    What popup will come when we open that search help in GUI
    Regards,
    Shobhit

Maybe you are looking for

  • Multiple Contracts VBAK-VBPA-VBPA2

    Firslty, ,I am new to this site so please tell me (politely) if I have posted in the wrong place ! My operation is to extract Quanity Contract data, to use outside of SAP. For any given Ship-to/Material, report the Quanity Contract data. I have ident

  • How to upgrade firefox in Ubuntu 10.04? Upgrade button is not present and unable to install the downloaded latest version.

    We have around 250 desktops where we have installed Linux Ubuntu 10.04, now the problem is that the Mozilla Firefox version in Ubuntu is 3.6 and the application we are using does not work correctly unless the firefox version is higher then 5.0, I hav

  • Aperture 3 & Mobile Gallery

    Anyone know why once you have created a Mobile me Gallery in Aperture 3 with a Gallery description then published to your gallery online, you can't change the description (not the title by the way) later. Well you can in Aperture but after you publis

  • How to make Reports 9i display Danish national characters?

    I am running Oracle9i Reports and cannot make Reports print the Danish national characters f, F, x, X, e and E. I have a development machine with Developer Suite 9.0.2, where I can run the report in Paper Design, where the characters displays correct

  • All reply buttons stopped working in rel. 24.3.0

    this morning all reply buttons stopped working. I can compose emails but cannot reply to anyone. No voluntary update was made in the last days and everything was working properly till Friday, three days ago. May you please urgently help me? Thanks ve