[JBoss Seam] - Remoting-Calls to SSB are not stateful
by mugwump
I have some troubles with my very naive approach to use a Stateful Session Bean together with Seam.Remoting:
The Scenario:
User loads Page with a Multiple-Choice-Test. All questions are fetched from the server, each question is setup via javascript on the client. Each answer is sent to the server. At the end of the test, we redirect to a page to display the test-results.
We try to implement this using:
- Seam.Remoting to make up the Connection
- Javascript to setup the questions
- A stateful session Bean to hold the test and the results.
- A conversation to demarcate start and end of the test.
Alas, this does not work out-of-the-box: The problem is, that the remoting does not reconnect to the SSB, but instead starts new SSB's. Here is a rough sketch of the code:
the SSB:
| @Stateful
| @Name ("examManager")
| @Scope(ScopeType.SESSION)
| public class ExamManagerBean implements ExamManager {
|
| @Begin
| public Test startTest(int testId) {
| ....
| }
|
|
| public void sendAnswer(int questionId, int answerId){
| ....
| }
|
| @End
| public String getResults(){
| ...;
| }
|
| }
|
with all three Methods exposed in the ExamManager via @WebRemote.
The javascript:
| var remoteManager = Seam.Component.getInstance("examManager");
| remoteManager.startTest(id, testLoaded)
|
| function testLoaded(test){
| setupNextQuestion(test);
| ....
| }
|
| function evaluateAnswer(){
| remoteManager.sendAnswer(test.questions[questionIdx].id, answerId, answerCallback);
| ....
| }
|
|
The Test is fetched correctly and the first two calls to remoteManager.sendAnswer go to the same SSB with which the Test was started, the third call goes to another SSB and fails there, becaus the startTest() was never called and therefore the test not initialized.
I checked via Seam.Remoting.getContext().getConversationId() that every Remoting-Call happens within the same context, so I'm puzzled and can't figure out, why the SSB-references are not stable in between the remoting calls... Is there something fundamentally wrong with this approach or am I simply missing a switch here somehwhere??!
Thx for any hint&help
Stefan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010385#4010385
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010385
19Â years, 2Â months
[JBoss Messaging] - Want to disable Clustering ...
by Craig2007
Hi
I am using JBoss Messaging 1.0.1.GA and JBoss AS 4.0.4.GA.
If i start another JBoss Server with JBoss Messaging enabled,clustering of both servers take place by default
Wanted to know how to disable clustering in my JBoss App Server
Below is the part of whole console log
09:24:48,375 INFO [Server] JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)] Started in 34s:579ms
17:23:50,545 INFO [DefaultPartition] New cluster view for partition DefaultPartition (id: 1, delta: 1) : [192.168.251.101:1099, 192.168.251.36:1099]
17:23:50,639 INFO [DefaultPartition] I am (192.168.251.101:1099) received membershipChanged event:
17:23:50,639 INFO [DefaultPartition] Dead members: 0 ([])
17:23:50,654 INFO [DefaultPartition] New Members : 1 ([192.168.251.36:1099])
17:23:50,654 INFO [DefaultPartition] All Members : 2 ([192.168.251.101:1099, 192.168.251.36:1099])
17:23:56,342 INFO [TreeCache] locking the / subtree to return the in-memory (transient) state
17:23:57,639 INFO [StateTransferGenerator_1241] returning the state for tree rooted in /(1024 bytes)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010384#4010384
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010384
19Â years, 2Â months