<!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;">
    How to implement a custom identity model for JBoss Portal?
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/prisemut">Thomas Raab</a> in <i>JBoss Portal</i> - <a href="http://community.jboss.org/message/637123#637123">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I want to implement a custom identity model in order to connect to a proprietary webservice providing user information.</p><p>So I followed the instructions on <a class="jive-link-external-small" href="http://docs.jboss.com/jbportal/v2.7.1/referenceGuide/html/identity.html">http://docs.jboss.com/jbportal/v2.7.1/referenceGuide/html/identity.html</a>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am using JBoss Portal 2.7.2 with JBoss AS 4.2.3; java version 1.6.0_29</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here are the steps that I've done:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Creating a new maven project, pom.xml snippet:</p><pre class="jive-pre"><code class="jive-code jive-xml">
<span class="jive-xml-tag">&lt;dependency&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;groupId&gt;</span>org.jboss.portal.identity<span class="jive-xml-tag">&lt;/groupId&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;artifactId&gt;</span>identity-identity<span class="jive-xml-tag">&lt;/artifactId&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;version&gt;</span>1.0.7<span class="jive-xml-tag">&lt;/version&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;scope&gt;</span>provided<span class="jive-xml-tag">&lt;/scope&gt;</span>
<span class="jive-xml-tag">&lt;/dependency&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Implementation of the User interface:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">
package com.mycompany.myIdentity;

import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.User;

public class MyUserImpl implements User {
...
}
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Packaged to a jar file and deployed (= copied) to </p><p>\jboss-portal-2.7.2\server\default\deploy\jboss-portal.sar\lib.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Changes in \jboss-portal-2.7.2\server\default\deploy\jboss-portal.sar\conf\identity\identity-config.xml, </p><p>replacing the existing User-type module with the new one (it doesn't need any config):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml">
<span class="jive-xml-tag">&lt;module&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;type&gt;</span>User<span class="jive-xml-tag">&lt;/type&gt;</span>

&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;service-name&gt;</span>portal:service=Module,type=User<span class="jive-xml-tag">&lt;/service-name&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;class&gt;</span>com.mycompany.myIdentity.MyUserImpl<span class="jive-xml-tag">&lt;/class&gt;</span>

&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;config/&gt;</span>
<span class="jive-xml-tag">&lt;/module&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>After starting the server by double-clicking the run.bat und browsing the site </span><a class="jive-link-external-small" href="http://localhost:8080/portal" target="_blank">http://localhost:8080/portal</a></p><p>I get the following exception:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>exception</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>javax.servlet.ServletException: org.hibernate.HibernateException: Unable to locate current JTA transaction</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:278)</p><p>&#160;&#160;&#160;&#160; javax.servlet.http.HttpServlet.service(HttpServlet.java:803)</p><p>&#160;&#160;&#160;&#160; org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>root cause</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>org.hibernate.HibernateException: Unable to locate current JTA transaction</p><p>&#160;&#160;&#160;&#160; org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)</p><p>&#160;&#160;&#160;&#160; org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:544)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObjectNode(PersistentPortalObjectContainer.java:252)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.core.impl.model.portal.AbstractPortalObjectContainer.getContext(AbstractPortalObjectContainer.java:112)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.core.impl.model.portal.AbstractPortalObjectContainer.getContext(AbstractPortalObjectContainer.java:81)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.core.model.portal.DefaultPortalCommandFactory.doMapping(DefaultPortalCommandFactory.java:72)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.core.controller.Controller.handle(Controller.java:252)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.server.RequestControllerDispatcher.invoke(RequestControllerDispatcher.java:51)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:131)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.common.invocation.Invocation.invoke(Invocation.java:157)</p><p>&#160;&#160;&#160;&#160; org.jboss.portal.server.servlet.PortalServlet.service(PortalServlet.java:252)</p><p>&#160;&#160;&#160;&#160; javax.servlet.http.HttpServlet.service(HttpServlet.java:803)</p><p>&#160;&#160;&#160;&#160; org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I get the same exception even without deploying the jar file, just by changing the identity-config.xml file. So I assume</p><p>that my jar isn't loaded at all. Furthermore my new module has nothing to do with databases and thus needs no JTA transaction.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>So what am I missing to get this thing working?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks in advance for your help.</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/637123#637123">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>