Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8692187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:16:13+00:00 2026-06-13T00:16:13+00:00

How can I access the RedHat directory server / HP UX Directory server using

  • 0

How can I access the RedHat directory server / HP UX Directory server using LDAPS from my Java application? I am trying to access it through LDAP it’s working fine but while using LDAPS it doesn’t establishing the connection with the server.

Here is my code, which is not working:

public void setPassword(String userDn,String password) {
    InitialDirContext ctx=null;
    DirContext connection;
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    String systemname = "ldaps://myserver:636";
    env.put(Context.PROVIDER_URL, systemname);  
    env.put(Context.SECURITY_PRINCIPAL, "cn=directory manager");
    env.put(Context.SECURITY_CREDENTIALS, "MySecret");
    ctx = new InitialDirContext(env);
    connection = (DirContext)ctx;
    connection.lookup("dc=mydomain,dc=com");
    ModificationItem[] mods = new ModificationItem[1];
    Attribute mod0 = new BasicAttribute("userpassword",password);
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
    connection.modifyAttributes(userDn, mods);
    connection.close();
}

The above code works fine if I replace the ldaps by ldap.

But I need the code to work for LDAPS as well. Some sites mention the need for a keystore, certificate, etc. But I don’t know about these anything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:16:14+00:00Added an answer on June 13, 2026 at 12:16 am

    As you are using Java, you need to obtain a copy of the server’s certificate or Certificate Authority Chain and add it to the Java Keystore for the JVM you are using with your code.

    How to accomplish obtaining the certificate is dependent on the LDAP implementation you are using. The LDAP admin should be able to help.

    As to adding the certificate(s) the the Java KeyStore, see Google.

    -jim

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can access the database either from a .NET program (using ODBC) or through
As you know anyone can access strings in an native application using a hex
I can access to my local file through NSURL by using: NSURLRequest *request =
I can access MS Sql from a web application resides in Windows. But it
I can upload a file to my Apache web server using Curl just fine:
I can't access my host machine from my guest machine using the computer name
I can connect to VPN and I can access Sql Server using RDP. Now,
In Java you can access variables in a class by using the keyword this
Can i access an application which is running in the background from a browser
you can access View's model from the View methods - like render() (through its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.