some examples are not working

hi guys
trying to get the most benefits of vaadin because i really like it - currently iam trying to create a RIA and off course i reach the moment of forms , i tried to look in the forms and datamodels examples in the demo section i found the form section , simply i took that code i revamp it to my needs (imports , package , etc). did not work out , i even copy the code i paste it like it is same error happen (cannot cast to com.vaadin.application) , same error happen even when i use the login form code:

i gone through the forum to check why is this problem happening iam afraid i didnot reach to any solutions , mean while the tutorial work like a charm :
i cant understand if the problem is in the code or in my usage , please help and thanks in advance.

iam using eclipse Ganymede , vaadin 6.2.6



Sorry but I did not really catch what the problem was. Could you describe exactly which code you copied, what was the problem that you encountered, what steps did you take to produce that error (was it on startup, visual or after that you pressed something). A stack trace would also help.

hi jens
Thanks for the reply , here is the code :

package com.example;

import com.vaadin.ui.LoginForm;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.LoginForm.LoginEvent;

public class combo extends VerticalLayout {

    public combo() {

        LoginForm login = new LoginForm();
        login.addListener(new LoginForm.LoginListener() {
            public void onLogin(LoginEvent event) {
                        "New Login",
                        "Username: " + event.getLoginParameter("username")
                                + ", password: "
                                + event.getLoginParameter("password"));


stack trace:

javax.servlet.ServletException: java.lang.ClassCastException: com.example.combo cannot be cast to com.vaadin.Application

root cause 

java.lang.ClassCastException: com.example.combo cannot be cast to com.vaadin.Application

thanks for your help

Any help???

My guess is that you have defined your combo class as the application class in your web.xml. You should have an actual application class defined as you application in the web.xml.

Your code should look something like this

public YourApplication extends Application {
    public void init() {
        Window mainWindow = new Window();
        mainWindow.addComponent(new combo());


The code for each sample in the Sampler is not a self-contained working application. It’s more of a CustomComponent, that you can place inside your application.

So the easiest way to copy-paste code from the Sampler is to create a stub application first, and then copy the contents (i.e. the code in the constructor) of a sample inside the init method of your stub application.

Kim thanks for your relpy , but iam not sure i get you well , iam just doing what has been came in the tutorials and the vaadin book.

here is my web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">
  	Vaadin production mode</description>
  		<description>combo class to start</description>

What do i need to change ?

Thanks in advance

Jouni thanks for your reply , would you please describe to me how i can do that step in details , or if you have an online example for it ,sorry iam totally new to it and i have broke my head trying to find a solution for it.


yeah, the problem is that you have the entry point to your example set to com.example.combo in your web.xml. This should point to something that extends Application. Your code is a VerticalLayout, and a layout is just one of many things that goes into an application. So what you need is an application that takes use of your layout.

Maybe the easiest way to get started is to copy paste the code that Kim posted into your application, and make web.xml point to that class (for example com.example.MyApplication where MyApplication extends Application). Working through the tutorials wouldn’t be a bad idea either.

The tutorials are working fine , the problem happen when i take that code from the samples , the errors began.
now iam trying to to work using custom composite - will try to put the inputs by the experimental editor , i just dont understand how iam gonna call that file.:frowning: