Using: jboss-portal-2.6-BETA1-bundled, configured to use MySQL as the datastore
I have a custom auth module that authenticates a user against Active Directory Server and drops a user into roles that are derived from ADS attributes. Upon successful authentication, as long as a user exists in the jbp_users table, I am able to log in successfully. However, if the user does not already exist in the jbp_users table, the following error occurs: | HTTP Status 500 - | | -------------------------------------------------------------------------------- | | type Exception report | | message | | description The server encountered an internal error () that prevented it from fulfilling this request. | | exception | | javax.servlet.ServletException | org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:407) | javax.servlet.http.HttpServlet.service(HttpServlet.java:810) | org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) | | | root cause | | java.lang.NullPointerException | org.jboss.portal.core.aspects.controller.PageCustomizerInterceptor.injectDashboardNav(PageCustomizerInterceptor.java:192) | | { snip } | | org.jboss.portal.common.invocation.Invocation.invoke(Invocation.java:157) | org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:381) | javax.servlet.http.HttpServlet.service(HttpServlet.java:810) | org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) | | | I have made the following attempt to create the user on the fly: | try { | UserModule userModule = (UserModule) new InitialContext().lookup("java:portal/UserModule"); | User user = null; | try{ | user = userModule.findUserByUserName("username"); | } catch (IdentityException nsue) { | //User Does Not Exist, so we need to create | try { | user = userModule.createUser("username", "password"); | } catch (IdentityException ie) { | //This should not happen | log.error("Error creating user", ie); | } | } | | try { | UserProfileModule userProfileModule = (UserProfileModule) new InitialContext().lookup("java:portal/UserProfileModule"); | userProfileModule.setProperty(user, User.INFO_USER_EMAIL_REAL, new StringBuffer("username").append("@email.com")); | userProfileModule.setProperty(user, User.INFO_USER_ENABLED, true); | userProfileModule.setProperty(user, User.INFO_USER_VIEW_EMAIL_VIEW_REAL, true); | userProfileModule.setProperty(user, User.INFO_USER_NAME_FAMILY, lastName); | userProfileModule.setProperty(user, User.INFO_USER_NAME_GIVEN, firstName); | } catch (IdentityException ie) { | log.error("Unable to update identity.", ie); | } | | } catch (NamingException e) { | log.error("Error in Create UserModule", e); | } | | When I execute this code, the following exception is thrown in the logs: | 2007-04-20 12:56:07,656 ERROR [com.workscape.auth.modules.ads.ADSAuth] Error creating user | org.jboss.portal.identity.IdentityException: Cannot create user username | at org.jboss.portal.identity.db.HibernateUserModuleImpl.createUser(HibernateUserModuleImpl.java:179) | at com.workscape.auth.modules.ads.ADSAuth.createLdapInitContext(ADSAuth.java:233) | at com.workscape.auth.modules.ads.ADSAuth.validatePassword(ADSAuth.java:137) | at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:210) | 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:585) | 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.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601) | at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535) | at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344) | at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491) | at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:257) | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416) | at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) | at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) | at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) | at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) | at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) | at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) | at java.lang.Thread.run(Thread.java:595) | Caused by: org.hibernate.HibernateException: Unable to locate current JTA transaction | at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61) | at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542) | at org.jboss.portal.identity.db.HibernateUserModuleImpl.getCurrentSession(HibernateUserModuleImpl.java:291) | at org.jboss.portal.identity.db.HibernateUserModuleImpl.createUser(HibernateUserModuleImpl.java:167) | ... 30 more | | It looks as if there might be some sort of configuration issue, or perhaps some preperatory coding, that I have missed because the error message states that it is "Caused by: org.hibernate.HibernateException: Unable to locate current JTA transaction" If there is any additional information required to help resolve this issue, please let me know and I will attach it to this thread. Thank you in advance for any assistance in this matter. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039384#4039384 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039384 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user