Solved

How do I fix an LDAP problem with websphere 7.0.0.11

Posted on 2010-08-26
5
1,441 Views
Last Modified: 2013-12-11
I've been trying to get a WAS 7 web app to validate a user login using LDAP.  

The server is is Websphere 7.0.0.11. The app is built using RAD 7.

The WAS 7 admin console LDAP configuration test connection function likes the connection.

However, at runtime the connection fails with the following error:

javax.naming.CommunicationException: 128.49.67.230:3269 [Root exception is java.lang.NullPointerException]

Interestingly, the code works when I run it in a standalone test driver.

The code segment is as follows:
                        
                        env.put(Context.INITIAL_CONTEXT_FACTORY, INITAL_CONTEXT_FACTORY);
                        env.put(Context.PROVIDER_URL, ldapConfig.get(PROVIDER_URL_KEY));
                        env.put(Context.SECURITY_PRINCIPAL, principal);
                        env.put(Context.SECURITY_CREDENTIALS, credentials);
                        env.put(Context.SECURITY_AUTHENTICATION, "simple");
                        env.put(Context.REFERRAL, "follow");
                        
                        if (((Boolean) ldapConfig.get(SSL_ENABLED_KEY)).booleanValue()) {
                              env.put(Context.SECURITY_PROTOCOL, "ssl");
                              Properties modLdapProp = new Properties();
                                        modLdapProp.load(Resources.getResourceAsStream(Configuration.MOD_LDAP));

                              System.setProperty(
                                    "javax.net.ssl.trustStore",
                                    (String) modLdapProp.get("trustStore"));
                        }

                        dirContext = new InitialDirContext(env);

The stack trace is as follows:

[8/26/10 19:56:48:820 GMT] 0000001f ActiveDirecto E mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService initDirContext javax.naming.CommunicationException: 128.49.67.230:3269 [Root exception is java.lang.NullPointerException]
[8/26/10 19:56:48:820 GMT] 0000001f SystemOut     O mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService.getSearchConstraints
[8/26/10 19:56:48:820 GMT] 0000001f SystemOut     O mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService msg:
Unable to complete search for: dc=twofive,dc=dev Cause:
[8/26/10 19:56:48:851 GMT] 0000001f ActiveDirecto E mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService getUserForUsername Unable to complete search for: dc=twofive,dc=dev Cause:
                                 java.lang.NullPointerException
      at mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService.getUserForUsername(ActiveDirectoryLDAPService.java:333)
      at mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService.getAttributeValueForUser(ActiveDirectoryLDAPService.java:889)
      at mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService.getAttributeValueForUsername(ActiveDirectoryLDAPService.java:885)
      at mil.navy.spawar.ncs.wds.common.ldap.ActiveDirectoryLDAPService.getDistinguishedNameForUser(ActiveDirectoryLDAPService.java:927)
      at mil.navy.spawar.ncs.wds.common.core.filter.UserInfoFilter.refreshLogin(UserInfoFilter.java:314)
      at mil.navy.spawar.ncs.wds.common.core.filter.UserInfoFilter.doFilter(UserInfoFilter.java:170)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
      at mil.navy.spawar.ncs.wds.common.core.filter.LoginFilter.doFilter(LoginFilter.java:118)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:997)
      at com.ibm.ws.webcontainer.webapp.WebApp.invokeFilters(WebApp.java:3916)
      at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3765)
      at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
      at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
      at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
      at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1772)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)

0
Comment
Question by:edhewlett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Author Comment

by:edhewlett
ID: 33578516
I found the problem. Remove the stmt:

System.setProperty(
                                    "javax.net.ssl.trustStore",
                                    (String) modLdapProp.get("trustStore"));

and the code works....
0
 

Accepted Solution

by:
EE_AutoDeleter earned 0 total points
ID: 33845928
edhewlett,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question