Search code examples
javaclassnotfoundexceptionvaadin7

Vaadin Formsender Add on - ClassNotFoundException


I'm using vaadin 7 and trying to use the formsender add on. I have added the below dependency,

<dependency>
    <groupId>org.vaadin.addons</groupId>
    <artifactId>canvas</artifactId>
    <version>2.1</version>
</dependency>

But I am still getting the below error when starting the server. I have searched around but cannot find what dependency is needed. I have a feeling this was part of vaadin 6. If that is the case, what is the vaadin 7 equivalent to FormSender?

Caused by: java.lang.ClassNotFoundException: com.vaadin.terminal.PaintTarget

Simple test program,

package grouptest;

import javax.servlet.annotation.WebServlet;

import org.vaadin.risto.formsender.FormSender;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

/**
 * This UI is the application entry point. A UI may either represent a browser window 
 * (or tab) or some part of a html page where a Vaadin application is embedded.
 * <p>
 * The UI is initialized using {@link #init(VaadinRequest)}. This method is intended to be 
 * overridden to add component to the user interface and initialize non-component functionality.
 */
@SuppressWarnings("serial")
@Theme("mytheme")
@Widgetset("grouptest.MyAppWidgetset")
public class MyUI extends UI {

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        final VerticalLayout layout = new VerticalLayout();
        final FormSender formSender = new FormSender();

        formSender.setFormMethod(FormSender.Method.POST);
        formSender.setFormTarget("http://localhost:8080/birt/frameset");
        formSender.addValue("__report", "erro.rptdesign");

        System.out.println(formSender.getValues());       

        Button button = new Button("Click Me");
        button.addClickListener( e -> {

            formSender.submit(); 

        });

        layout.addComponents(button, formSender);
        layout.setMargin(true);
        layout.setSpacing(true);

        setContent(layout);
    }

    @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
    @VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
    public static class MyUIServlet extends VaadinServlet {
    }
}

Solution

  • I not sure about version but for class you will have to add dependency for

    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin</artifactId>
        <version>6.2.3</version>
    </dependency>