[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How do I fix an LDAP problem with websphere 7.0.0.11

Posted on 2010-08-26
5
Medium Priority
?
1,485 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

650 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