Vaadin 7 and Tomcat cluster

Hi Andre,
Soory for the late reply for your post, I was checking my application with your gven confirgurations in both Ubuntu and windows platforms and I have used exact versions that you mentioned. But yet I am facing the same problem and I will explain my test scenario again for you.
"
The problem is when I kill one tomcat instance, In webapp I can’t work continuously with In the current web page. I am getting a notification in browser telling that “Internal Problem take note of any unsaved data and click here to continue” and the below exception is printed in terminal. Allso I have to refresh my current page to recover. But the session data is replicated between the cluster and I am not re directed to the Login Page
" In vaadin 7.1 and vaadin 7.2 it gives the notification as "
Communication Problem take note…
". Can you check wether my application work which I upload in my last post with your configurations and It will be a great help.

Thanks.

Hi,
I’ve been working on a similar problem with our Vaadin app. My setup is: Vaadin 7.2, Tomcat 7.0.53, mod_jk 1.2.40, Java 1.7,

Using a simple session.jsp I observed session replication working properly.

However in Vaadin replication only seemed to partially work. I could see through the tomcat manager that my session existed on the backup node, but I would get a “Communication Error” in the browser after a node failure and it seemed that the session on the backup node wasn’t getting fully replicated.

Then I found this post:
http://stackoverflow.com/questions/2680958/is-there-a-usedirtyflag-option-for-tomcat-6-cluster-configuration

Next I proved this was the issue with some simple test code using:

VaadinSession.getCurrent().setAttribute() For this case I observed anything I set in the session using the above method (which our app relies on) didn’t get replicated.
Then I tried:

VaadinSession.getCurrent().getSession().setAttribute() This returns the WrappedSession and observed this did get replicated to the backup node.

Next I compiled the “ForceReplicationValve” from the stackoverflow post, and added it to my server.xml:

<Valve className="org.apache.catalina.ha.tcp.ForceReplicationValve"/> Now both methods work, and our Vaadin app which puts many things in the VaadinSession is mostly working (still a few Serializable issues).

I’m not sure why André seems to have avoided this issue, maybe he is using sessions differently.
Hope this helps.

I am using VaadinSession.getCurrent().getSession().setAttribute() to insert information in session and did not use ForceReplicationValve.
Miyuru, try to create a simpler project. Use the wizard from Vaadin plugin of Eclipse and, without changing it, see if it works in your configuration. Did you try the configuration I posted above? I don´t have access to it right now, but as soon as possible I will post the example I used to test the environment.

Hi Andre,
Yes I tested my application with you configurations in both Linux and Windows platforms but it didn’t helped me. I will try to create another small app using the wizard but It ideal thing for me is create it as a maven project.


Christopher, Is ForceReplicationValve support in tomcat 7 because I got classNotFoundExptions when I add,
.

Thanks.

Attached the application I used to to my tests. See if it works in your environment.
14120.zip (14.2 KB)

Hi Andre,
I have test your application with my configurations but I am getting the "
Communication Problem take note…
" yet when I click the "
Click Me Button
" soon after I kill one tomcat instance. So double check with your configrations I have add mu both tomcat instances server.xml files and apache workers.properties files and httpd.conf file. If you have time can you check with you configrations and give me your feedback.

Thanks
14129.zip (13.8 KB)

Hi Miyura,
No, its not included with Tomcat. I had to compile the source myself and include it in the classpath.

We too are facing serious issues with vaadin on tomcat cluster in our production env, We tried your suggestions as well but Vaadin Session is never getting replicated. UIs are kept in Vaadin Session and since it is not getting replicated I get internal error when one tomcat node failed or restarted. This is a serious issue and need immediate help.

Thank

Note : HTTP session is getting replicated properly but the Vaadin Session is not getting replicated!

Hi,
I have manged to solve my problem

Thanks.

jayamal, this sounds like the same issue I encountered which was solved using the ForceReplicationValve discussed earlier in the thread.

Miyuru, can you comment on what the problem and solution were for others that may have the same?

Thanks

HI André, seems like your solution is not working. I have done the same exact thing that you have done and still vaadin session is not getting replicated but http session does. Can you please double check vaadin session is getting replicated or not? If vaadin is not working on cluster env, then it is a serious issue. If everything works fine then please take few hours to write a tutorial on configuring tomcat for vaadin.

Hi Christopher, can you please provide your server xml where you have configured the forece replication valve so that I can give it a try?

jayamal,
I put the details earlier in this thread. Basically add the following to server.xml inside your element.

You need to compile ForceReplicationValve from source and include it in the classpath as its not part of standard Tomcat.
See
http://stackoverflow.com/questions/2680958/is-there-a-usedirtyflag-option-for-tomcat-6-cluster-configuration

I don’t understand why its working for Andre without this. He stated he is using VaadinSession.getCurrent().getSession().setAttribute() which should work regardless, however as you stated Vaadin keeps the UI in the VaadinSession itself, so I don’t see how thats working for him.

Hi Christopher,

Thanks Christopher, I tried by adding the
after addin forceReplication class as jar to the tomcat lib folder and that worked.
I have debuged my test application in tomcat cluster environment and I think I found the root case.

When we use wrapped session it just a session that just tomcat need but in wrapped session there is know other specific atributes which are in vaadin session and Vaadin framework use Vaadin session attributes internaly in many places
. Till one tomcat instance get killed the application works perfectly but when a tomcat instance is down the wrapped session get replicated and it dosen’t have any other special attributes that are in Vaadin Session.


SEVERE:
javax.servlet.ServletException: No UIProvider returned a UI for the request.

The reason for the above exception is there is a special Map called
Map<Integer, UI> uIs
in vaadin session that keeps data about our UI calsses and It dosen’t contain the maching data for the current request.

Thanks