Solved

How do I fix an LDAP problem with websphere 7.0.0.11

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
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…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now