[JBoss Seam] - Re: Feature request regarding nested conversations
by jacob.orshalick
Thanks for the excellent information and the informative links Matt!
anonymous wrote : It seems like you're embellishing Seam's behavior a little bit. It's my understanding that when you begin a nested conversation, Seam doesn't take a snapshot, it just creates a new empty "container", and prevents you from storing new objects in the parent container....
|
| So, to get the behavior you're talking about, I think you'd need to manually clone the person object when starting a nested conversation. The "original state" Person would stay in the parent conversation, and the new cloned Person, which might be edited, goes in the nested conversation.
You are absolutely correct Matt! I suppose I am embellishing Seam's behavior ;) I am cloning the Person object when starting a nested conversation which would obviously be problematic when using an SMPC since the instance would no longer be managed on cloning.
The reason the approach works is performing the merge at the end. The detached instance is merged back with the attached "managed" instance. Thus, whichever instance it finds first during the lookup (the clone in the nested conversation or the original in the outer conversation) is the instance that is merged.
Thanks for increasing my understanding here on use of SMPCs with your information and the provided links. The approach I've used works well for my client (who have many of these mother-child scenarios and do not require an SMPC) but it is important to note that this is not viable for managed entities.
One question. If I cloned my Person in the nested conversation and then merged the clone to retrieve the attached instance, I'm assuming I would now have the same reference in both my outer and inner conversation. Is this assumption correct? Thanks again.
By the way, on an unrelated note, how are you guys crediting quotes (e.g. "jacob orshalick" wrote). I want to make sure I'm giving credit where credit is due :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086097#4086097
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086097
18 years, 10 months
[JBoss Seam] - EjbSynchronizations not bound
by wise_guybg
Hi,
I updated to Seam 2.0.0.CR1 and tried again (no luck in B1) to set <transaction:ejb-transaction/> in components.xml. On deploy an exception occurs:
anonymous wrote : NameNotFoundException: EjbSynchronizations not bound
This is the stack trace:
anonymous wrote :
| 15:59:24,616 ERROR [SeamPhaseListener] uncaught exception
| java.lang.IllegalStateException: Could not start transaction
| at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:571)
| at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:307)
| at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
| at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:853)
| at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
| at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1513)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.synchronizations
| at org.jboss.seam.Component.newInstance(Component.java:1971)
| at org.jboss.seam.Component.getInstance(Component.java:1874)
| at org.jboss.seam.Component.getInstance(Component.java:1853)
| at org.jboss.seam.Component.getInstance(Component.java:1847)
| at org.jboss.seam.transaction.AbstractUserTransaction.getSynchronizations(AbstractUserTransaction.java:79)
| at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:40)
| at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:566)
| ... 46 more
| Caused by: javax.naming.NameNotFoundException: EjbSynchronizations not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.seam.Component.instantiateSessionBean(Component.java:1288)
| at org.jboss.seam.Component.instantiate(Component.java:1274)
| at org.jboss.seam.Component.newInstance(Component.java:1967)
| ... 52 more
|
Before the exception there is:
anonymous wrote : 15:55:41,782 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.transaction.synchronizations
And also:
anonymous wrote : 15:55:43,244 INFO [Component] Component: org.jboss.seam.transaction.synchronizations, scope: EVENT, type: STATEFUL_SESSION_BEAN, class: org.jboss.seam.transaction.EjbSynchronizations, JNDI: ExamCenter-EE/EjbSynchronizations/local
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086094#4086094
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086094
18 years, 10 months
[JBoss Portal] - Custem JAAS IdentityLoginModule
by PVApparao
Hi I am using the following code to authenticate users to my portal.
public class SsoLoginModule extends IdentityLoginModule
| {
| private static final Logger logger = Logger.getLogger(SsoLoginModule.class);
| private static final String DEFAULT_USER_ROLE = "User";
| private static final String JNDI_TRANS_MGR = "java:/TransactionManager";
| private static final String POLICY_CONTEXT_HTTP_SERVLET =
| "javax.servlet.http.HttpServletRequest";
| private static final String OPTION_NAME_DEFAULT_ROLE = "defaultRole";
| private static final String OPTION_NAME_ROLE_MOD_JNDI = "roleModuleJNDIName";
|
|
|
|
| // public static final short UNDEFINED_TIMEZONE = (short)0;
|
| protected String defaultRoleForNewUser = DEFAULT_USER_ROLE;
| protected String roleModuleJNDIName;
| private RoleModule roleModule = null;
| private UserModule userModule = null;
| private UserProfileModule userProfileModule = null;
| private MembershipModule membershipModule = null;
| private Transaction transaction;
| private SessionFactory identitySessionFactory;
| private boolean success;
| private Session session;
|
| /**
| * Initialize the login module.
| * @param subject Authentication subject
| * @param callbackHandler Callback handler for the login module
| * @param sharedState Shared State Map
| * @param options Configuration options of the login module
| */
| public void initialize(Subject subject, CallbackHandler callbackHandler,
| Map sharedState, Map options) {
| super.initialize(subject, callbackHandler, sharedState, options);
| logger.info("Initializing login module.");
| String specifiedDefaultRole=(String)options.get(OPTION_NAME_DEFAULT_ROLE);
| if (!isNullOrEmpty(specifiedDefaultRole)) {
| defaultRoleForNewUser = specifiedDefaultRole;
| }
| roleModuleJNDIName = (String)options.get(OPTION_NAME_ROLE_MOD_JNDI);
| logger.info("Role module JNDI = "+roleModuleJNDIName);
| }
|
| /**
| * Perform log in process.
| */
| public boolean login() throws LoginException {
| logger.info("Inside login.");
| createUserIfNew();
| return super.login();
| }
|
| /**
| * Create user if user does not exist.
| */
| protected void createUserIfNew() throws LoginException {
| try {
| logger.info("Inside createUserIfNew.");
| TransactionManager tm = (TransactionManager)
| new InitialContext().lookup(JNDI_TRANS_MGR);
| Transactions.required(tm, new Transactions.Runnable() {
| public Object run() throws Exception {
| String username = null;
| User user = null;
| try {
| username = (getUsernameAndPassword())[0];
| logger.info("Username = " + username);
|
| try {
|
| userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
| logger.info("After getting the UserModule");
| roleModule = (RoleModule)new InitialContext().lookup("java:/portal/RoleModule");
| logger.info("After getting the RoleModule");
| userProfileModule = (UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");
| logger.info("After getting the UserProfileModule");
| membershipModule = (MembershipModule)new InitialContext().lookup("java:portal/MembershipModule");
| //logger.info("After getting the MembershipModule");
| } catch (NamingException e1) {
| // TODO Auto-generated catch block
| e1.printStackTrace();
| }
| /*userModule = getUserModule();
| // roleModule = getRoleModule();
| //membershipModule = getMembershipModule();
| logger.info("After getting the UserModule");
| userProfileModule = getUserProfileModule();
| logger.info("After getting the UserProfileModule");*/
| logger.info("Before getting user from UserModule.");
| //identitySessionFactory = (SessionFactory)new InitialContext().lookup("java:/portal/IdentitySessionFactory");
| //session = identitySessionFactory.openSession();
| // transaction = session.beginTransaction();
| user = userModule.findUserByUserName(username);
| logger.info("User ID in the table jbp_users ="+user.getId().toString());
| fillContextWithUserProfile(userProfileModule, user);
| // success = true;
| return null;
| }
| catch(NoSuchUserException nsue) {
| // User not found, let's create it
| logger.info("Create new user " + username);
| HttpServletRequest request = getHttpServletRequest();
| logger.info(request.getHeader(Constant.SSO_UID)+","+
| request.getHeader(Constant.SSO_GESSOUID));
| logger.info("Just about to create User");
| user = userModule.createUser(
| request.getHeader(Constant.SSO_UID),"Pa55word");
| // request.getHeader(Constant.SSO_EMAIL));
| logger.info("User object is ="+user);
| logger.info("User created successfully");
| if(null == userProfileModule) {
| userProfileModule = getUserProfileModule();
|
| }
| fillContextWithUserProfile(userProfileModule, user);
| Set roleSet = new HashSet();
| roleSet.add(getRoleModule().findRoleByName(defaultRoleForNewUser));
| membershipModule = getMembershipModule();
| membershipModule.assignRoles(user, roleSet);
| //success = true;
| return null;
| }
| catch (Exception e) {
| e.printStackTrace();
| throw new LoginException("Error in find/create user: " +
| e.getMessage());
It is working fine upto the red marked line, at that line it is giving the following exception ClassCastException : org.jboss.portal.idetity.db.HibernateRoleModuleImpl.
I configured inside my login-config.xml as below
| <policy>
| <!-- For the JCR CMS -->
| <application-policy name="cms">
| <authentication>
| <login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
| </authentication>
| </application-policy>
|
| <!-- <application-policy name="portal">
| <authentication>-->
|
| <!--To configure LDAP support with IdentityLoginModule please check documentation on how to
| configure portal identity modules for this-->
| <!-- <login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">
| <module-option name="unauthenticatedIdentity">guest</module-option>
| <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
| <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
| <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
| <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
| <module-option name="additionalRole">Authenticated</module-option>
| <module-option name="password-stacking">useFirstPass</module-option>
| </login-module>-->
|
|
| <application-policy name="portal">
| <authentication>
| <login-module code="com.ge.health.jboss.portal.security.jaas.SsoLoginModule" flag="required">
| <module-option name="unauthenticatedIdentity">guest</module-option>
| <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
| <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
| <module-option name="membershipModuleJNDIName">java:/portal/MembershipModule</module-option>
| <module-option name="userProfileModuleJNDIName">java:/portal/UserProfileModule</module-option>
| <module-option name="additionalRole">Authenticated</module-option>
| <module-option name="password-stacking">useFirstPass</module-option>
| <module-option name="defaultRole">User</module-option>
| </login-module>[/code}]
|
|
|
| when i try to login i am getting the 403 error saying authentication failed.
|
|
| Can any one help me to reslove this issue.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086090#4086090
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086090
18 years, 10 months
[JBoss Portal] - Users and groups
by cgrahl
Hello,
I have a custom JAAS login module works fine with JBossPortal. This login module authenticates on my system, using a webservice for that. Everything is ok. Or almost.. :-)
Now i have this problem:
In my system, i have tree users:
user/user, admin/admin and foo/bar
and the default portal instalation have only two users:
user/user and admin/admin.
When i login with "user" or "admin", the portal works fine, but when i login with the "foo" user, i can't go to the dashboard.
Seems like i have to duplicate my user database: one copy on my system and other one on the portal. Is that correct? There's no way to configure the portal to use my user database?
Thank you again
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086088#4086088
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086088
18 years, 10 months