[Clustering/JBoss] - Re: Singleton Failover
by chanyungwan
There are totally 3 singletons. Make it simple, may be we use 1 singleton to illustrate the scenario. What I mean the "long" time for launching it in 2nd case is that the singleton almost needs 2 - 3 minutes for being completion of running its constructor and "startSingleton" method defined in jboss-service.xml, then finally the new cluster view is built. You can see the following log in 2nd node once I quit the master node using "Ctrl-C":
:
:
:
10:02:17,628 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
10:02:18,030 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8009
10:02:18,143 INFO [JkMain] Jk running ID=0 time=0/249 config=null
10:03:20,704 INFO [STDOUT] calling singleton constructor
10:05:21,489 INFO [STDOUT] starting singleton...
10:07:21,572 INFO [ServiceModule] Registration is not done -> stop
10:07:21,641 INFO [EmmgClusterPartition] New cluster view (id: 2, delta: -1) : [192.168.10.231:1099]
10:07:21,642 INFO [EmmgClusterPartition:ReplicantManager] Dead members: 1
Since there are 3 singletons in my case, so the total time for "completing" their activation is about 10 minutes. It's really a big problem for us!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959401#3959401
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959401
19 years, 9 months
[JBoss Seam] - how to configure a session bean managing entity beans with @
by dbatcn
I would like to have a web page where a user can manage "groups" that he or she belongs to. There are entity beans for users and groups, which have a @ManyToMany relationship (where I've set the user as the owning side). The MessageManagerBean class in the examples seemed very similar to what I need, so I started with that and made a "groupManager" stateful session bean; the user is injected from having logged in and the @DataModel is a list of the groups that the user belongs to. The user entity bean has a collection of groups and the group entity bean has a collection of users, with appropriate EJB3 annotations. When I try to bring up the group management page that references the group manager bean, I get:
| org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.orgmob.member.User.groups, no session or session was closed
|
I looked at http://www.jboss.com/index.html?module=bb&op=viewtopic&t=85894&start=0, which seems to suggest using eager fetching for this, but since there's a many-to-many relationship, I'd have the risk of pulling the entire user and group tables into memory, wouldn't I?
What's the right approach for this? Thanks in advance and apologies if I've missed previously posted discussion or documentation or am misunderstanding eager fetching.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959400#3959400
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959400
19 years, 9 months
[JBoss Seam] - Re: how to stop unknown user from seeing a page
by dbatcn
Hmmm, I just tried this. How does one do it correctly? A simple implementation of that falls into an infinite loop between the browser and Seam/Faces:
There's a "login.xhtml" page associated with a "login" action and a "groups.xhtml" page associated with a "groups" action. After a successful login, the application should take you to the groups page. The very first time the groups page is invoked, it detects that the user is not logged in and correctly redirects to the login page. However, after the successful login, it seems that the page action and the faces navigation just bounce back and forth with the browser.
pages.xml:
| <pages>
| <page view-id="/groups.xhtml" action="#{groupManager.forceLogin}"/>
| </pages>
|
faces-config.xml snippet:
| <navigation-case>
| <from-outcome>login</from-outcome>
| <to-view-id>/login.xhtml</to-view-id>
| <redirect />
| </navigation-case>
| <navigation-case>
| <from-outcome>groups</from-outcome>
| <to-view-id>/groups.xhtml</to-view-id>
| <redirect />
| </navigation-case>
|
snippet of the group manager bean:
| @Stateful
| @Name("groupManager")
| @Scope(SESSION)
| @LoggedIn
| public class GroupManagerBean implements GroupManager, Serializable {
| ...
| public String forceLogin() {
| String forcedAction;
| if ( LoggedInInterceptor.isLoggedIn() ) {
| forcedAction = "groups";
| }
| else {
| forcedAction = "login";
| facesMessages.add("#{messages.infoLoginRequired}");
| }
| System.out.println("GroupManagerBean.forceLogin() returning "+forcedAction);
| return forcedAction;
| }
| ...
| }
|
LoggedInInterceptor.java snippet
| @Around({BijectionInterceptor.class, ValidationInterceptor.class,
| ConversationInterceptor.class, BusinessProcessInterceptor.class})
| @Within(RemoveInterceptor.class)
| public class LoggedInInterceptor {
|
| ...
|
| public static boolean isLoggedIn() {
| boolean isLoggedInNow = Contexts.getSessionContext().get("loggedIn")!=null;
| System.out.println("LoggedInInterceptor.isLoggedIn() returning "+isLoggedInNow);
| return isLoggedInNow;
| }
|
| }
|
console output:
| 17:59:44,976 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning false
| 18:00:07,210 INFO [STDOUT] LoginAction.login() returning groups
| 18:00:07,226 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,226 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,226 INFO [STDOUT] GroupManagerBean.forceLogin() returning groups
| 18:00:07,242 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,242 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,242 INFO [STDOUT] GroupManagerBean.forceLogin() returning groups
| 18:00:07,257 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,257 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,257 INFO [STDOUT] GroupManagerBean.forceLogin() returning groups
| 18:00:07,273 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,288 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,288 INFO [STDOUT] GroupManagerBean.forceLogin() returning groups
| 18:00:07,304 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,304 INFO [STDOUT] LoggedInInterceptor.isLoggedIn() returning true
| 18:00:07,304 INFO [STDOUT] GroupManagerBean.forceLogin() returning groups
| .
| .
| .
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959395#3959395
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959395
19 years, 9 months