[jboss-user] [Security] - Re: NullPointerException @ DatabaseServerLoginModule.java:14
mactex
do-not-reply at jboss.com
Thu Sep 10 08:29:53 EDT 2009
I get exactly the same error message when trying to use the Databaseserver loginmodule. I use JBoss 4.2.3. In the log there is the following:
javax.security.auth.login.LoginException: java.lang.NullPointerException
| at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:141)
| at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:206)
|
It seems from the source file, that the Datasource returned is null. It's the following source in the login module:
InitialContext ctx = new InitialContext();
| DataSource ds = (DataSource) ctx.lookup(dsJndiName);
| conn = ds.getConnection();
|
I configured everything from the documentation.
login-config.xml:
<application-policy name = "nedbDbLogin">
| <authentication>
| <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
| flag="required">
| <module-option name="dsJndiName">java:jdbc/bavnedb</module-option>
| <!--<module-option name="hashAlgorithm">MD5</module-option>
| <module-option name="hashEncoding">base64</module-option> -->
| <module-option name="principalsQuery">
| select password from USER where LOGIN_ID=?</module-option>
| <module-option name="rolesQuery">
| select 'Nedb_User', 'Roles' from USER where LOGIN_ID=?</module-option>
| </login-module>
| </authentication>
| </application-policy>
|
jboss-web.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <jboss-web>
| <security-domain>java:/jaas/nedbDbLogin</security-domain>
| </jboss-web>
The code for the programmatic login:
| UsernamePasswordHandler handler = new UsernamePasswordHandler(userId, password);
|
| LoginContext loginContext = new LoginContext(LOGIN_CONTEXT,
| (CallbackHandler) handler);
| loginContext.login();
|
Do you have any idea what can be wrong?
Thanks in advance
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254426#4254426
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254426
More information about the jboss-user
mailing list