1 Reply Latest reply: Dec 7, 2011 3:49 AM by Thomas Delhoménie RSS

    Hibernate exception with orgService.getUserHandler().findUserByName(userid)

    bharath sadanagiri Newbie

      Hi,
      In gatein-3.1.0, to add the user to gate-in database I am finding the user in portal database whether exists or not but
      orgService.getUserHandler().findUserByName is throwing the following exception.
      Do I need to do any thing more set-up?
      Thanks,
      Bharath
                 ExoContainer container = getContainer();
              IdentityRegistry identityRegistry = (IdentityRegistry) container.getComponentInstanceOfType(IdentityRegistry.class);
                 Authenticator authenticator = (Authenticator) container.getComponentInstanceOfType(Authenticator.class);
              OrganizationService orgService = (OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);
               
                 User user = orgService.getUserHandler().findUserByName(userId);

      2011-11-25 07:57:26,674 INFO  [org.exoplatform.services.organization.idm.UserDAOImpl] (http-10.19.47.197-8122-2) Cannot obtain user: sadanajeinci;
      org.picketlink.idm.common.exception.IdentityException: IdentityObjectType[USER] not present in the store.
      at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.getHibernateIdentityObjectType(HibernateIdentityStoreImpl.java:2586)
      at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.findIdentityObject(HibernateIdentityStoreImpl.java:659)
      at org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository.findIdentityObject(WrapperIdentityStoreRepository.java:155)
      at org.picketlink.idm.impl.api.session.managers.PersistenceManagerImpl.findUser(PersistenceManagerImpl.java:426)
      at org.exoplatform.services.organization.idm.UserDAOImpl.getPopulatedUser(UserDAOImpl.java:638)
      at org.exoplatform.services.organization.idm.UserDAOImpl.findUserByName(UserDAOImpl.java:283)
      at com.adp.sbs.si.jaas.SBSJAASLoginModule.addUserToPlatformUsers(SBSJAASLoginModule.java:154)
      at com.adp.sbs.si.jaas.SBSJAASLoginModule.login(SBSJAASLoginModule.java:115)
      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:258)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
      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.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: org.hibernate.HibernateException: createCriteria is not valid without active transaction
      at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:339)
      at $Proxy189.createCriteria(Unknown Source)
      at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.getHibernateIdentityObjectType(HibernateIdentityStoreImpl.java:2560)
      ... 36 more