Vaadin “A connector with id xy is already registered”

前端 未结 4 935
眼角桃花
眼角桃花 2021-01-02 04:01

Somewhere in my Vaadin application, I\'m getting this exception as soon as I connect using a second browser

Caused by: java.lang.RuntimeException: A connector

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-02 04:34

    Here is how I fixed it -

    1) look for components you have shared across sessions. For example if you have declared a component as static it will be created once and will be shared.

    2) if you are not able to find it and want a work around until you figure out the real problem, put your all addComponent calls in try and in catch add following code -

    getUI().getConnectorTracker().markAllConnectorsDirty();
    getUI().getConnectorTracker().markAllClientSidesUnititialized();
    getPage().reload():
    

    This will clear old connectors and will reload the page properly only when it fails. For me it was failing when I was logged out and logged in back.

    Once you find the real problem you can fix it till then inform your customers about the reload.

    **** note - only solution is to remove shared components this is just a work around.

提交回复
热议问题