I’m experiencing a bad randomic problem.
I’m using the Addon Popup button and, usually, it works.
However, sometime it breaks with
ClassCastException: com.vaadin.shared.AbstractComponentState cannot be cast to com.vaadin.shared.ui.button.ButtonState
and from that moment evry time I run my application I get this error.
I didn’t find a standard procedure to get out of the error.
Cleaning, removing, adding, recreating the widgetset sometime seems to solve.
Could someone provide an help ?
Tks
Tullio
Hi,
I’ve used the PopupButton add-on quite extensively and have not seen anything like this. Does the exception originate in vaadin code, the addon’s code or your own code? It could help if you provide the full stack trace log as well as the versions of vaadin and popupbutton you are using.
Please see
Developing add-on - problem with dependencies?
. I had axactly the same error, when building my project with ant. Solution was to use Eclipse compiler.
Here the stacktrace.
I don’t know where the problem originate, but it breaks without any apparent reason and ther’s no way to restart.
Tks
java.lang.ClassCastException: com.vaadin.shared.AbstractComponentState cannot be cast to com.vaadin.shared.ui.button.ButtonState
at com.vaadin.ui.Button.getState(Button.java:581)
at org.vaadin.hene.popupbutton.PopupButton.getState(PopupButton.java:226)
at axioma.web.template.ui.components.PopupButtonBase.getState(PopupButtonBase.java:7)
at com.vaadin.ui.AbstractComponent.setCaption(AbstractComponent.java:249)
at com.vaadin.ui.Button.(Button.java:99)
at org.vaadin.hene.popupbutton.PopupButton.(PopupButton.java:61)
at axioma.web.template.ui.components.PopupButtonBase.(PopupButtonBase.java:20)
at axioma.web.template.ui.components.PopupButtonBase.(PopupButtonBase.java:16)
at axioma.web.template.ui.bars.PaxToolbar.addOperations(PaxToolbar.java:67)
at axioma.web.template.ui.bars.ListToolbar.init(ListToolbar.java:36)
at axioma.web.template.ui.bars.ListToolbar.(ListToolbar.java:20)
at axioma.web.configuratore.ui.functions.storie.StorieStorieTable.createToolbar(StorieStorieTable.java:71)
at axioma.web.template.ui.pages.ToolbarPage.build(ToolbarPage.java:24)
at axioma.web.template.ui.pages.TablePage.build(TablePage.java:34)
at axioma.web.template.ui.pages.InternalPage.getPageComponent(InternalPage.java:54)
at axioma.web.template.ui.pages.FunctionMasterPage.onPage(FunctionMasterPage.java:168)
at axioma.web.pax.ui.impl.PaxNavigatorImpl.processSubPageRequest(PaxNavigatorImpl.java:408)
at axioma.web.pax.ui.impl.PaxNavigatorImpl.navigateTo(PaxNavigatorImpl.java:366)
at com.vaadin.navigator.Navigator.navigateTo(Navigator.java:526)
at axioma.web.pax.ui.impl.PaxNavigatorImpl.navigateTo(PaxNavigatorImpl.java:341)
at axioma.web.template.ui.app.TemplateNavigator.navigateTo(TemplateNavigator.java:38)
at axioma.web.pax.ui.impl.PaxNavigatorImpl.open(PaxNavigatorImpl.java:238)
at axioma.web.template.ui.pages.FunctionMasterPage.openPages(FunctionMasterPage.java:128)
at axioma.web.template.ui.pages.FunctionMasterPage.handleRequestChangeEvent(FunctionMasterPage.java:119)
at axioma.web.template.ui.pages.FunctionMasterPage.handleEvent(FunctionMasterPage.java:100)
at axioma.web.template.ui.functions.FunctionEventManager.publishSingleEvent(FunctionEventManager.java:36)
at axioma.web.template.ui.functions.FunctionEventManager.publish(FunctionEventManager.java:25)
at axioma.web.template.ui.functions.MenuFunction.publish(MenuFunction.java:31)
at axioma.web.template.ui.functions.PageFunction.startPage(PageFunction.java:59)
at axioma.web.template.ui.functions.PageFunction.execute(PageFunction.java:41)
at axioma.web.template.ui.commands.FunctionRunner.runFunction(FunctionRunner.java:21)
at axioma.web.template.ui.commands.FunctionCommand.execute(FunctionCommand.java:19)
at axioma.web.template.ui.bars.PaxMenuBar$1.menuSelected(PaxMenuBar.java:29)
at com.vaadin.ui.MenuBar.changeVariables(MenuBar.java:186)
at com.vaadin.server.communication.ServerRpcHandler.changeVariables(ServerRpcHandler.java:396)
at com.vaadin.server.communication.ServerRpcHandler.handleBurst(ServerRpcHandler.java:221)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:111)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1371)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Agata I don’t use ant but maven.
What do You mean with using the Eclipse compiler ?
The addon is not produced by myself, I use a “standard” one.
Tks
That was my case as well. As descriibed in the
post
changing the default ant compiler:
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
helped. It can be set in maven with
compiler plugin
.
I have been bitten by this bug as well. The problem occurs when you extend the PopupButton class. For some reason, some compilers (e.g. IDEA compiler) create a synthetic public getState() method which returns AbstractComponentState type. Vaadin then takes the AbstractComponentState class, creates an instance of it and sets it to the button as its state. See AbstractClientConnector.createState() for details. I have opened a bug for this: http://dev.vaadin.com/ticket/14003
As a workaround, just add the following method to the class which extends PopupButton:
@Override
public PopupButtonState getState() {
return super.getState();
}