[JBoss Portal] - Hibernate exception when using the JBoss Portal Identity Man
by npillingcorda
JBoss Portal Version: 2.6.4
Did you get Portal from CVS? or download it? downloaded jboss-portal-2.6.4-bundled.zip
OS Platform: Linux Fedora Core 4
JVM 1.5.0_11
I'm trying to use the JBoss Portal Identity Management API to get information about the logged-in user from JBoss Portal in a portlet. The API is described on: http://docs.jboss.com/jbportal/v2.6.4/referenceGuide/html/identity.html.
I'm getting the following stack trace:
2008-02-25 10:58:11,521 ERROR [org.jboss.portal.identity.db.HibernateUserModuleImpl] Cannot find user by name admin
| 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:544)
| at org.jboss.portal.identity.db.HibernateUserModuleImpl.getCurrentSession(HibernateUserModuleImpl.java:298)
| at org.jboss.portal.identity.db.HibernateUserModuleImpl.findUserByUserName(HibernateUserModuleImpl.java:90)
| at com.corda.centerview.auth.JBossPortalDirectory.getUser(JBossPortalDirectory.java:59)
| at com.corda.centerview.auth.JBossPortalDirectory.isValidUser(JBossPortalDirectory.java:116)
| at com.corda.centerview.auth.JBossPortalPlugin.isValidUser(JBossPortalPlugin.java:51)
| at com.corda.centerview.auth.JBossPortalPlugin.authenticate(JBossPortalPlugin.java:29)
|
| import java.util.HashSet;
| import java.util.Set;
| import javax.naming.*;
| import org.jboss.portal.identity.*;
| import com.corda.cvserver.AuthPlugin;
|
| public class JBossPortalDirectory
| {
| UserModule userModule;
| RoleModule roleModule;
| MembershipModule membershipModule;
| UserProfileModule userProfileModule;
|
| public JBossPortalDirectory()
| {
| try
| {
| membershipModule = (MembershipModule)new InitialContext().lookup("java:portal/MembershipModule");
| roleModule = (RoleModule)new InitialContext().lookup("java:portal/RoleModule");
| userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
| userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
|
| AuthPlugin.logError("MembershipModule: " + membershipModule);
| AuthPlugin.logError("RoleModule: " + roleModule);
| AuthPlugin.logError("UserModule: " + userModule);
| AuthPlugin.logError("UserProfileModule: " + userProfileModule);
| }
| catch (NamingException e)
| {
| AuthPlugin.logError("Naming Exception", e);
| }
| /*
| catch (IdentityException e)
| {
| AuthPlugin.logError("Identity Exception", e);
| }
| */
| catch (IllegalArgumentException e)
| {
| AuthPlugin.logError("Illegal Argument Exception", e);
| }
| }
|
| private User getUser(String username)
| {
| User user = null;
| try
| {
| user = userModule.findUserByUserName(username);
| }
| catch(Exception e)
| {
| AuthPlugin.logError("Exception in getUser(" + username + ")", e);
| }
| return user;
| }
|
| public Set<String> getGroups()
| {
| Set<String> groups = new HashSet<String>();
|
| try
| {
| Set<Role> roles = roleModule.findRoles();
| for(Role role : roles)
| {
| groups.add(role.getName());
| }
| }
| catch(Exception e)
| {
| AuthPlugin.logError("Exception in getGroups()", e);
| }
|
| return groups;
| }
|
| public Set<String> getGroups(String username)
| {
| Set<String> groups = new HashSet<String>();
|
| User user = getUser(username);
| if(user != null)
| {
| try
| {
| Set<Role> roles = membershipModule.getRoles(user);
| for(Role role : roles)
| {
| groups.add(role.getName());
| }
| }
| catch(Exception e)
| {
| AuthPlugin.logError("Exception in getGroups(" + username + ")", e);
| }
| }
|
| return groups;
| }
|
| public boolean isValidUser(String username)
| {
| boolean validUser = false;
|
| User user = getUser(username);
| if(user != null)
| {
| validUser = true;
| }
|
| return validUser;
| }
| }
|
import java.util.Set;
| import javax.servlet.http.HttpServletRequest;
| import com.corda.cvserver.AuthPlugin;
|
| public class JBossPortalPlugin extends AuthPlugin
| {
| JBossPortalDirectory jbossPortalDirectory;
|
| public JBossPortalPlugin()
| {
| jbossPortalDirectory = new JBossPortalDirectory();
| }
|
| public boolean authenticate(HttpServletRequest request)
| {
| setAuthenticated(false);
|
| String username = request.getRemoteUser();
| if(isValidUser(username))
| {
| setAuthenticated(true);
| setUserName(username);
| setGroupList(getGroupList(username));
| }
|
| return isAuthenticated();
| }
|
| public Set<String> getGroupList(String username)
| {
| return jbossPortalDirectory.getGroups(username);
| }
|
| public Set<String> getGroups()
| {
| return jbossPortalDirectory.getGroups();
| }
|
| public boolean isValidUser(String username)
| {
| return jbossPortalDirectory.isValidUser(username);
| }
| }
Am I doing something wrong or is there a problem I need to work around?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131963#4131963
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131963
16 years, 8 months
[JBoss jBPM] - Fork --> Join issues
by QPool.Char
I have a small problem here:
Processdefinition contains a situation, where a fork has 3 child-taskNodes and just 2 of them will join again:
TaskNode A -------> Fork
Fork --------> TaskNode B
Fork --------> TaskNode C1
Fork --------> TaskNode C2
TaskNode B ---------> EndState
TaskNode C1 ---------> Join
TaskNode C2 ---------> Join
Join ---------> TaskNode D
Now, when executing this path after the fork, the following procedures WORK:
B .signal()
C1 .signal()
C2. signal()
or
C1.signal()
B.signal()
C2.signal()
So as long as B has ended before C1 and C2, everything seems to be ok.
But if C1 and C2 end before B, then the only open task is Task B. But Task D, which should occur after the JOIN, is missing.
I check all taskInstances of one certain processInstance with
TaskMgmtInstance taskMgmt = processInstance.getTaskMgmtInstance();
| Collection<TaskInstance> allTaskInstances = taskMgmt.getTaskInstances();
Searching the forum results in some posts that say:
- a JOIN is always coupled with a FORK in some way (i guess its the nearest fork then)
- a JOIN expects exactly the number of incoming tokens that the fork created
Is this right? But this behaviour wouldn't explain why it works with ended B, but not otherwise...
Is there any workaround?
Btw @Kukeltje: I searched in the CVS for unit-tests, but could you give me a hint where to find them? I checked out "jbpm.3".
Thx in advance
alex
thx in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131959#4131959
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131959
16 years, 8 months