Solved

How do I fix an LDAP problem with websphere 7.0.0.11

Posted on 2010-08-26
5
1,434 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
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ArrayIndexOutOfBoundException 9 82
object oriented programming comparison 5 72
reverse digits of a number using for loop 5 41
going to wrong jsp page 2 21
Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 video teaches viewers about errors in exception handling.

777 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