[jboss-user] [Datasource Configuration] - Re: ClassCastException
Pierre Guillemot
do-not-reply at jboss.com
Thu Feb 16 14:42:07 EST 2012
Pierre Guillemot [https://community.jboss.org/people/hnb] created the discussion
"Re: ClassCastException"
To view the discussion, visit: https://community.jboss.org/message/717296#717296
--------------------------------------------------------------
It's me again, i am still facing the same issue while trying to implement a secure domain for my application :
20:34:55,853 TRACE [org.jboss.security.SecurityRolesAssociation] Setting threadlocal:{}
20:34:55,863 DEBUG [org.jboss.security.integration.JNDIBasedSecurityManagement] Creating SDC for domain=youfoodinc_domain
20:34:55,864 TRACE [org.jboss.security.plugins.JaasSecurityManager] Constructing
20:34:55,864 DEBUG [org.jboss.security.plugins.auth.JaasSecurityManagerBase.youfoodinc_domain] CallbackHandler: org.jboss.security.auth.callback.JBossCallbackHandler at 174e5edb
20:34:55,864 DEBUG [org.jboss.security.plugins.auth.JaasSecurityManagerBase.youfoodinc_domain] CachePolicy set to: org.jboss.security.auth.AuthenticationTimedCachePolicy at 6edc77c4
20:34:55,995 DEBUG [org.jboss.security.integration.JNDIBasedSecurityManagement] setCachePolicy, c=org.jboss.security.auth.AuthenticationTimedCachePolicy at 6edc77c4
20:34:55,997 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.youfoodinc_domain] Begin isValid, principal:test at test.fr, cache info: null
20:34:55,997 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.youfoodinc_domain] defaultLogin, principal=test at test.fr
20:34:55,998 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] Begin getAppConfigurationEntry(youfoodinc_domain), size=12
20:34:56,050 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] End getAppConfigurationEntry(youfoodinc_domain), authInfo=AppConfigurationEntry[]:
[0]
LoginModule Class: org.jboss.security.auth.spi.DatabaseServerLoginModule
ControlFlag: LoginModuleControlFlag : required
Options:
name=principalsQuery, value=SELECT password FROM _user WHERE email='test at test.fr'
name=dsJndiName, value=java:/MySqlDs
name=rolesQuery, value=SELECT _role, 'Roles' FROM _user WHERE email='test at test.fr'
20:34:56,058 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] initialize
20:34:56,099 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] Security domain: youfoodinc_domain
20:34:56,099 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] DatabaseServerLoginModule, dsJndiName=java:/MySqlDs
20:34:56,099 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] principalsQuery=SELECT password FROM _user WHERE email='test at test.fr'
20:34:56,100 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] rolesQuery=SELECT _role, 'Roles' FROM _user WHERE email='test at test.fr'
20:34:56,149 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendResume=true
20:34:56,151 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] login
20:34:56,152 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendAnyTransaction
20:34:56,153 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] resumeAnyTransaction
20:34:56,154 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] abort
20:34:56,155 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.youfoodinc_domain] Login failure: javax.security.auth.login.LoginException: java.lang.ClassCastException: org.jboss.jpa.injection.InjectedEntityManagerFactory cannot be cast to javax.sql.DataSource
at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:172)
at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:245)
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 javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
at org.jboss.security.plugins.auth.JaasSecurityManagerBase.defaultLogin(JaasSecurityManagerBase.java:553)
at org.jboss.security.plugins.auth.JaasSecurityManagerBase.authenticate(JaasSecurityManagerBase.java:487)
at org.jboss.security.plugins.auth.JaasSecurityManagerBase.isValid(JaasSecurityManagerBase.java:365)
at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:160)
at org.jboss.web.tomcat.security.JBossWebRealm.authenticate(JBossWebRealm.java:399)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:256)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:485)
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
at java.lang.Thread.run(Thread.java:662)
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872) [:1.6.0_31]
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [:1.6.0_31]
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) [:1.6.0_31]
at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_31]
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) [:1.6.0_31]
at javax.security.auth.login.LoginContext.login(LoginContext.java:579) [:1.6.0_31]
at org.jboss.security.plugins.auth.JaasSecurityManagerBase.defaultLogin(JaasSecurityManagerBase.java:553) [:3.0.0.CR2]
at org.jboss.security.plugins.auth.JaasSecurityManagerBase.authenticate(JaasSecurityManagerBase.java:487) [:3.0.0.CR2]
at org.jboss.security.plugins.auth.JaasSecurityManagerBase.isValid(JaasSecurityManagerBase.java:365) [:3.0.0.CR2]
at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:160) [:6.0.0.Final]
at org.jboss.web.tomcat.security.JBossWebRealm.authenticate(JBossWebRealm.java:399) [:6.0.0.Final]
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:256) [:6.0.0.Final]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:485) [:6.0.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_31]
20:34:56,200 TRACE [org.jboss.security.plugins.auth.JaasSecurityManagerBase.youfoodinc_domain] End isValid, false
I stil have the same Persistence Unit and Datasource.
I modified the login-conf.xml to include :
<!--YouFood inc-->
<application-policy name="youfoodinc_domain">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
<module-option name="dsJndiName">java:/MySqlDs</module-option>
<module-option name="principalsQuery">SELECT password FROM _user WHERE email='test at test.fr'</module-option>
<module-option name="rolesQuery">SELECT _role, 'Roles' FROM _user WHERE email='test at test.fr'</module-option>
</login-module>
</authentication>
</application-policy>
I modified jboss-web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/YouFoodInc</context-root>
<security-domain>java:/jaas/youfoodinc_domain</security-domain>
</jboss-web>
As well as web.xml, which is a bit long, i will put it if someone' asking for.
It's a very weird error, I have no idea why it happened. Seems like it's using another jar ? I haven't changed my AS's jar (except for the mysql driver inside lib).
Any idea anyone ??
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/717296#717296]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120216/96873ef4/attachment-0001.html
More information about the jboss-user
mailing list