GeeCON Prague 2014*
The moose likes JForum and the fly likes successful LDAP authentication results in InvocationTargetException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » JForum
Bookmark "successful LDAP authentication results in InvocationTargetException" Watch "successful LDAP authentication results in InvocationTargetException" New topic
Author

successful LDAP authentication results in InvocationTargetException

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I have configured LDAP with Jforum 2.1.8 and I am getting hit @ my LDAP server

But in JForum, I am getting invocationTargetException.. This is the log
:07,396 INFO [ConfigLoader ] Loading clickstream config from /home/sguruvar/Desktop/shiv/apache_tomcat_6_0_18/webapps/ETForum/WEB-INF/config/clickstream-jforum.xml

04:56:25,359 ERROR [ExceptionWriter ] net.jforum.exceptions.ForumException: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.jforum.Command.process(Command.java:114)
at net.jforum.JForum.processCommand(JForum.java:217)
at net.jforum.JForum.service(JForum.java:200)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
... 23 more
Caused by: java.lang.NullPointerException
at javax.naming.directory.BasicAttributes.get(BasicAttributes.java:144)
at net.jforum.sso.LDAPAuthenticator.validateLogin(LDAPAuthenticator.java:124)
at net.jforum.dao.generic.GenericUserDAO.validateLogin(GenericUserDAO.java:738)
at net.jforum.view.forum.UserAction.validateLogin(UserAction.java:578)
at net.jforum.view.forum.UserAction.validateLogin(UserAction.java:427)
... 23 more

URL is: /ETForum/jforum.page?null




Any help is much appreciated....



[originally posted on jforum.net by sivagurunath]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
IMHO, the LDAPAuthenticator is more along the lines of upscaled demo code than a full fledged production code.

Anyway, it looks like the error is because the getAttributes call (LDAPAuthenticatior line: 124) is returning null instead of the expected NamingException.

You will probably have to split this into two lines with a check to see if getAttributes returned null or not.
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Should I need to tweak the source code (LDAPAuthenticator.java)???
Can you elaborate on what I need to do as I am very new to JForum??


[originally posted on jforum.net by sivagurunath]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
The source for the LDAPAuthenticator is the place to start in understanding how jForum will validate against LDAP. Here you can see how the configuration properties get converted into LDAP lookup info (e.g. LDAP DN strings).

Note: anything that looks like:

SystemGlobals.getValue(ConfigKeys.X_Y_Z))

is getting the configuration setting for x.y.z. E.g. the ldap.login.prefix setting.

If I'm reading the code and error correctly, the code assumes that if the generated lookupPrincipal does not exist, a NamingException will be thrown by Java's Directory code. But this does not seem to be happening on your set up.

This could be due to a configuration issue or it could be due to a version difference in your version of the directory code.

The only way to really track this down is to play around with the code to find out. E.g. replace line 124 which reads:



with something like:


[originally posted on jforum.net by monroe]
 
GeeCON Prague 2014
 
subject: successful LDAP authentication results in InvocationTargetException