out of sync error on the login screen

hello vaadiners

I implemented the login/authentication mechanism in vaadin sometimes when the users press the login button or press enter théy sometimes the loading indicator just fades out and nothing happens even according to the logs the username and pasword were correct

And then when they press the login button once again they just get this out of sync error

The login screen is alsó implemented in vaadin (just 2 text fields and a button) the code that produces the login window is shown below :


private CustomLayout getLoginWindow() {

		if (loginLayout == null) {
			
			loginLayout = new CustomLayout("login-layout");
			loginLayout.addStyleName(CLASSNAME_LOGIN);
			loginLayout.setHeight("100%");
			
			
			
		loginError.addStyleName("login-error");
		loginError.setVisible(false);
		
		FocusListener focusListener= new FocusListener () {

			@Override
			public void focus(FocusEvent event) {
				loginError.setVisible(false);
				
			}
			
		};
		
		
		
		final 	Embedded logo = new Embedded(null, new ThemeResource("img/digic_logo.png"));
		final 	Embedded ferlauf = new Embedded(null, new ThemeResource("img/varlauf.png"));
			
			
			final TextField emailField = new TextField();
			
			emailField.setDebugId("login-email");
			emailField.setImmediate(false);
			
			
			emailField.addListener(focusListener);
			
			
	        final TextField passwordField = new TextField();
	        
	        passwordField.setDebugId("login-password");
	        passwordField.setImmediate(false);
			passwordField.setSecret(true);
			
			passwordField.addListener(focusListener);
			
			
		
			
			
			final Button loginButton = new Button("Sign in / Bejelentkezés",
					new Button.ClickListener() {
						public void buttonClick(ClickEvent event) {
							tryToLogIn(emailField.toString(), passwordField.toString(), false);
						}
					}
			);

			loginButton.setClickShortcut(KeyCode.ENTER, null);
			loginButton.addStyleName(CLASSNAME_LOGIN);
			
			loginLayout.addComponent(loginError, "login-error");
			loginLayout.addComponent(logo, "logo");
			loginLayout.addComponent(ferlauf, "verlauf");
			//loginLayout.addComponent(emailLabel, "email-label");
			loginLayout.addComponent(emailField, "email-field");
			//loginLayout.addComponent(passwordLabel, "password-label");
			loginLayout.addComponent(passwordField, "password-field");
			loginLayout.addComponent(loginButton, "login-button");
			
			
			
			
			
			
			

			
			
			
			
		}
		return loginLayout;

	}

here is excerpt from the tomcat log files


Aug 30, 2012 10:13:38 AM com.vaadin.Application terminalError
SEVERE: Terminal error:
com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClick in com.digicpictures.dproject.Dproject$2 failed.
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:530)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
	at com.vaadin.ui.Button.fireClick(Button.java:554)
	at com.vaadin.ui.Button.click(Button.java:543)
	at com.vaadin.ui.Button$ClickShortcut.handleAction(Button.java:688)
	at com.vaadin.event.ActionManager.handleAction(ActionManager.java:248)
	at com.vaadin.event.ActionManager.handleAction(ActionManager.java:243)
	at com.vaadin.event.ActionManager.handleActions(ActionManager.java:213)
	at com.vaadin.ui.Panel.changeVariables(Panel.java:370)
	at com.vaadin.ui.Window.changeVariables(Window.java:1115)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1460)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1404)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:318)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:582)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:196)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:679)
Caused by: java.util.ConcurrentModificationException
	at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:778)
	at java.util.LinkedList$ListItr.next(LinkedList.java:713)
	at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
	at com.vaadin.ui.Panel.attach(Panel.java:544)
	at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
	at com.vaadin.ui.AbstractComponentContainer.attach(AbstractComponentContainer.java:97)
	at com.digicpictures.dproject.MainWindow.attach(MainWindow.java:540)
	at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:560)
	at com.vaadin.ui.Panel.setContent(Panel.java:233)
	at com.digicpictures.dproject.Dproject.applicationUserChanged(Dproject.java:779)
	at com.vaadin.Application.setUser(Application.java:480)
	at com.digicpictures.dproject.Dproject.tryToLogIn(Dproject.java:340)
	at com.digicpictures.dproject.Dproject.access$0(Dproject.java:297)
	at com.digicpictures.dproject.Dproject$2.buttonClick(Dproject.java:246)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
	... 33 more
Aug 30, 2012 10:13:54 AM com.vaadin.terminal.gwt.server.AbstractCommunicationManager handleVariableBurst
WARNING: Warning: Ignoring variable change for non-existent component, VAR_PID=PID19
Aug 30, 2012 10:13:54 AM com.vaadin.terminal.gwt.server.AbstractCommunicationManager handleVariableBurst
WARNING: Warning: Ignoring variable change for non-existent component, VAR_PID=PID19
Aug 30, 2012 10:14:03 AM com.vaadin.terminal.gwt.server.AbstractCommunicationManager handleVariableBurst
WARNING: Warning: Ignoring variable change for non-existent component, VAR_PID=PID24
Aug 30, 2012 10:14:07 AM com.vaadin.terminal.gwt.server.AbstractCommunicationManager handleVariableBurst
WARNING: Warning: Ignoring variable change for non-existent component, VAR_PID=PID_Slogin-email
Aug 30, 2012 10:14:07 AM com.vaadin.terminal.gwt.server.AbstractCommunicationManager handleVariableBurst
WARNING: Warning: Ignoring variable change for non-existent component, VAR_PID=PID_Slogin-password
Aug 30, 2012 10:14:30 AM com.vaadin.terminal.gwt.server.AbstractCommunicationManager handleVariableBurst
WARNING: Warning: Ignoring variable change for non-existent component, VAR_PID=PID_Slogin-email


What could go wrong ? How to debug it and what can be the solution ?

Thank in advance for your advices :slight_smile:

Peter

Hi,

From the stack trace it looks like the component tree is manipulated in an attach() method. If that indeed is the case, you should move that code somewhere else, as adding/removing components during attach() will not work.

HTH,
/Jonatan

why adding or removing components in attach() method is bad/not working ?

I ask this because if I remember well there are some other situations where I use the attach() method to build the UI as well…

I usually use the attach () method to translate the UI, but sometimes I use it to add/remove components as well ( for example to refresh the UI)

I am also very interested in an answer to Peter’s question, as all of our applications are depending on setting components in the attach()-method (for ease-of-translation-reasons). We didn’t face any problems so far and have never heard of problems regarding this pattern, although we are in close contact with Vaadin-team.

I just confirmed from
this guy
that adding/removing components in the attach() method is fine and should work. Having said that, he also noted that it does not rule out the possibility of a bug hiding somewhere in Vaadin, e.g in the way how attach listeners are handled.

There are also some other things you can do in the attach() method to achieve an exception, but as said, adding/removing child components should not do it.

-Tepi