[jboss-user] [Security & JAAS/JBoss] - Re: Beginner's problems with ClientLoginModule

tdemuth do-not-reply at jboss.com
Thu Aug 23 08:27:19 EDT 2007


Well I have problems getting this running on my MySQL-Database. I think, the problem is, that I have not configured the MySQL-Datasource correctly.

This is my mysql-ds.xml-File:
<?xml version="1.0" encoding="UTF-8"?>
  | 
  | <datasources>
  |   <local-tx-datasource>
  |     <jndi-name>MySqlDS</jndi-name>
  |     <connection-url>jdbc:mysql://localhost:3306/cube</connection-url>
  |     <driver-class>com.mysql.jdbc.Driver</driver-class>
  |     <user-name>root</user-name>
  |     <password>password</password>
  |     <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
  |     <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
  |     <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
  |     <metadata>
  |        <type-mapping>mySQL</type-mapping>
  |     </metadata>
  |   </local-tx-datasource>
  | </datasources>

The JDBC-Driver lays in server/myServerInstance/lib.

The log-file contains the following exception when I try to login (code is shown in my first post):
2007-08-23 13:53:46,093 DEBUG [org.jboss.ejb3.security.Ejb3AuthenticationInterceptor] Authentication failure
  | javax.security.auth.login.LoginException: Query failed
  | 	at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:168)
  | 	at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:206)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  | 	at java.lang.reflect.Method.invoke(Unknown Source)
  | 	at javax.security.auth.login.LoginContext.invoke(Unknown Source)
  | 	at javax.security.auth.login.LoginContext.access$000(Unknown Source)
  | 	at javax.security.auth.login.LoginContext$4.run(Unknown Source)
  | 	at java.security.AccessController.doPrivileged(Native Method)
  | 	at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
  | 	at javax.security.auth.login.LoginContext.login(Unknown Source)
  | 	at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:603)
  | 	at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:537)
  | 	at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:123)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
  | 	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  | 	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  | 	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
  | 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
  | 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
  | 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
  | Caused by: org.jboss.util.NestedSQLException: Unexpected throwable while trying to create a connection: null; - nested throwable: (java.lang.reflect.UndeclaredThrowableException); - nested throwable: (org.jboss.resource.JBossResourceException: Unexpected throwable while trying to create a connection: null; - nested throwable: (java.lang.reflect.UndeclaredThrowableException))
  | 	at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
  | 	at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:141)
  | 	... 29 more
  | Caused by: org.jboss.resource.JBossResourceException: Unexpected throwable while trying to create a connection: null; - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
  | 	at org.jboss.resource.JBossResourceException.rethrowAsResourceException(JBossResourceException.java:61)
  | 	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:293)
  | 	at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:500)
  | 	at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
  | 	at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:315)
  | 	at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
  | 	at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
  | 	at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
  | 	... 30 more
  | Caused by: java.lang.reflect.UndeclaredThrowableException
  | 	at org.jboss.resource.JBossResourceException.process(JBossResourceException.java:204)
  | 	at org.jboss.resource.JBossResourceException.<init>(JBossResourceException.java:111)
  | 	... 38 more
  | Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
  | 	at java.lang.Class.forName0(Native Method)
  | 	at java.lang.Class.forName(Unknown Source)
  | 	at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:272)
  | 	at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:170)
  | 	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
  | 	at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
  | 	... 36 more

My login-conf.xml says the following:
<!-- The login used by the Cube-client -->
  | 	<application-policy name="cube">
  | 		<authentication>
  | 	    	<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
  | 	        	<module-option name="password-stacking">useFirstPass</module-option>
  | 	            <module-option name="dsJndiName">java:/MySqlDS</module-option>
  | 	           	<module-option name = "principalsQuery">SELECT Password FROM Principals WHERE PrincipalID=?</module-option>
  | 	           	<module-option name = "rolesQuery">SELECT Role, RoleGroup FROM Roles WHERE PrincipalID=?</module-option>
  | 	        </login-module>
  | 	    </authentication>
  | 	</application-policy>

My database-scheme is for testing-purposes just copied from the JBoss-Handbook:
Table Principals(PrincipalID text, Password text)
  | Table Roles(PrincipalID text, Role text, RoleGroup text)

Sorry for asking such "dumb" questions, but I don't how to track down this error. I hope, anybody can help me?!?

Thanks in advance,
Tobias

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077283#4077283

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077283



More information about the jboss-user mailing list