<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Hibernate exception with orgService.getUserHandler().findUserByName(userid)
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/jayabharath">bharath sadanagiri</a> in <i>JBoss Portal</i> - <a href="http://community.jboss.org/message/638399#638399">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,<br/>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<br/>orgService.getUserHandler().findUserByName is throwing the following exception. <br/>Do I need to do any thing more set-up?<br/>Thanks,<br/>Bharath<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ExoContainer container = getContainer();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; IdentityRegistry identityRegistry = (IdentityRegistry) container.getComponentInstanceOfType(IdentityRegistry.class);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Authenticator authenticator = (Authenticator) container.getComponentInstanceOfType(Authenticator.class);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; OrganizationService orgService = (OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; User user = orgService.getUserHandler().findUserByName(userId);</p><p>2011-11-25 07:57:26,674 INFO&#160; [org.exoplatform.services.organization.idm.UserDAOImpl] (http-10.19.47.197-8122-2) Cannot obtain user: sadanajeinci; <br/>org.picketlink.idm.common.exception.IdentityException: IdentityObjectType[USER] not present in the store.<br/>at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.getHibernateIdentityObjectType(HibernateIdentityStoreImpl.java:2586)<br/>at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.findIdentityObject(HibernateIdentityStoreImpl.java:659)<br/>at org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository.findIdentityObject(WrapperIdentityStoreRepository.java:155)<br/>at org.picketlink.idm.impl.api.session.managers.PersistenceManagerImpl.findUser(PersistenceManagerImpl.java:426)<br/>at org.exoplatform.services.organization.idm.UserDAOImpl.getPopulatedUser(UserDAOImpl.java:638)<br/>at org.exoplatform.services.organization.idm.UserDAOImpl.findUserByName(UserDAOImpl.java:283)<br/>at com.adp.sbs.si.jaas.SBSJAASLoginModule.addUserToPlatformUsers(SBSJAASLoginModule.java:154)<br/>at com.adp.sbs.si.jaas.SBSJAASLoginModule.login(SBSJAASLoginModule.java:115)<br/>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br/>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br/>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br/>at java.lang.reflect.Method.invoke(Method.java:597)<br/>at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)<br/>at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)<br/>at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)<br/>at java.security.AccessController.doPrivileged(Native Method)<br/>at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)<br/>at javax.security.auth.login.LoginContext.login(LoginContext.java:579)<br/>at org.jboss.security.plugins.auth.JaasSecurityManagerBase.defaultLogin(JaasSecurityManagerBase.java:553)<br/>at org.jboss.security.plugins.auth.JaasSecurityManagerBase.authenticate(JaasSecurityManagerBase.java:487)<br/>at org.jboss.security.plugins.auth.JaasSecurityManagerBase.isValid(JaasSecurityManagerBase.java:365)<br/>at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:160)<br/>at org.jboss.web.tomcat.security.JBossWebRealm.authenticate(JBossWebRealm.java:399)<br/>at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:258)<br/>at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:417)<br/>at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)<br/>at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)<br/>at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)<br/>at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)<br/>at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br/>at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)<br/>at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br/>at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)<br/>at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)<br/>at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)<br/>at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)<br/>at java.lang.Thread.run(Thread.java:662)<br/>Caused by: org.hibernate.HibernateException: createCriteria is not valid without active transaction<br/>at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:339)<br/>at $Proxy189.createCriteria(Unknown Source)<br/>at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.getHibernateIdentityObjectType(HibernateIdentityStoreImpl.java:2560)<br/>... 36 more</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/638399#638399">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Portal at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2011">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>