Solved

How do I fix an LDAP problem with websphere 7.0.0.11

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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java jdbc batch example 8 41
java stored proc example 9 44
throw exception 21 58
servlet and mdb, jms error 1 32
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…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

808 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