appreciated / vaadin-app-layout

<app-layout> integration for Vaadin 8.1+, 10+ and 14+
Apache License 2.0
83 stars 44 forks source link

NullPointerException 4.0.0.beta2 and missing styles #289

Closed lucastanzani closed 5 years ago

lucastanzani commented 5 years ago

Describe the bug When using version 4.0.0.2 beta, app-layout init fails at withAppBar call. Caused by: java.lang.NullPointerException: null at com.github.appreciated.app.layout.component.builder.AppLayoutBuilder.setAppBarComponent(AppLayoutBuilder.java:111) ~[app-layout-addon-4.0.0.beta2.jar:4.0.0.beta2] at com.github.appreciated.app.layout.component.builder.AppLayoutBuilder.withAppBar(AppLayoutBuilder.java:106) ~[app-layout-addon-4.0.0.beta2.jar:4.0.0.beta2]

Moreover, any standard vaadin page in the project is not styled (even if not using app-layout at all):

Vaadin not working 1

If I revert back to 3.0.0.beta5 without compatibility mode I obviously don't get app-layout working, but the above styling problem of the home page doesn't show up. If i turn on compatibility mode, everything works (with old project structure and minor changes in app layout) I read it could be conflicting dependencies, but I don't know how to solve it.

I might be missing something. In that case sorry, and thank you!

My pom: `<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>com.tds.manager</groupId>
<artifactId>tds-webapp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>TDS Webapp</name>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <!-- Dependencies -->
    <vaadin.version>14.0.3</vaadin.version>

    <!-- Overrides the old version specified by the Spring Boot parent -->
    <selenium.version>3.141.59</selenium.version>

    <!-- Plugins -->
    <frontend.maven.plugin.version>1.8</frontend.maven.plugin.version>
    <maven.war.plugin.version>3.1.0</maven.war.plugin.version>
    <maven.resources.plugin.version>3.0.2</maven.resources.plugin.version>
    <maven.clean.plugin.version>3.0.0</maven.clean.plugin.version>
    <maven.surefire.plugin.version>2.21.0</maven.surefire.plugin.version>

    <gatling.version>3.0.2</gatling.version>
    <gatling-plugin.version>3.0.1</gatling-plugin.version>
    <scala-maven-plugin.version>3.4.4</scala-maven-plugin.version>

    <!-- Frontend -->
    <node.version>v8.16.0</node.version>
    <yarn.version>v1.16.0</yarn.version>
    <buildtools.directory>build-tools</buildtools.directory>
</properties>

<repositories>
    <repository>
        <id>vaadin-addons</id>
        <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>https://repo.maven.apache.org/maven2</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>vaadin-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-core</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
    </dependency>

    <!-- Vaadin -->
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-spring</artifactId>
    </dependency>
    <dependency>
        <groupId>org.vaadin.artur</groupId>
        <artifactId>spring-data-provider</artifactId>
        <version>2.0.1</version>
    </dependency>
    <!-- End of Vaadin -->

    <!-- Spring -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat-juli</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat-jdbc</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-mail</artifactId>
        <version>2.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!-- End Spring -->
    <!-- Add JAXB explicitly as the java.xml.bind module is not included
         by default anymore in Java 9-->
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
    </dependency>
    <!-- Compile scope is needed to run on WildFly -->
    <dependency>
        <groupId>org.reactivestreams</groupId>
        <artifactId>reactive-streams</artifactId>
    </dependency>
    <!-- Testing -->
    <dependency>
        <groupId>com.github.appreciated</groupId>
        <artifactId>app-layout-addon</artifactId>
        <version>4.0.0.beta2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.11.3</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.vaadin.olli</groupId>
        <artifactId>clipboardhelper</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-select-flow</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-combo-box-flow</artifactId>
        <version>3.0.2</version>
    </dependency>

</dependencies>

<build>
    <defaultGoal>spring-boot:run</defaultGoal>
    <!-- The `pluginManagement` section allows listing plugin versions and their global
         configuration in one place. -->
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven.resources.plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven.war.plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend.maven.plugin.version}</version>
                <configuration>
                    <nodeVersion>${node.version}</nodeVersion>
                    <yarnVersion>${yarn.version}</yarnVersion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-frontend</goal>
                        <goal>build-frontend</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <!-- Production mode is activated using -Pproduction -->
        <id>production</id>
        <properties>
            <vaadin.productionMode>true</vaadin.productionMode>
        </properties>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>flow-server-production-mode</artifactId>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <goals>
                                <goal>build-frontend</goal>
                            </goals>
                            <phase>compile</phase>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <!-- Moving spring-boot start/stop into a separate profile speeds up regular builds.
         Execute mvn verify -Pit to run integration tests -->
</profiles>

`

My AppLayout class:

public abstract class MainView extends AppLayoutRouterLayout<LeftLayouts.LeftResponsive> implements BeforeEnterObserver, PageConfigurator, HasLogger {

    public MainView() {

        Span test = new Span("TDS Webapp");
        test.addClickListener(spanClickEvent -> UI.getCurrent().navigate(HomeView.class));
        test.addClassName("title-component");
        Image logo = new Image("frontend/images/icon-96.png", "icon");
        logo.addClassName("logo-component");
        logo.addClickListener(spanClickEvent -> UI.getCurrent().navigate(HomeView.class));

        StudentDataHolder sdh = BeanService.getBean(StudentDataHolder.class);
        TopClickableItem loginHeader;
        AppLayout appLayout;
        if (SecurityUtils.isUserLoggedIn() && sdh.isStudentLoggedIn()) {
            SecurityUser principal = (SecurityUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
            loginHeader = new TopClickableItem(principal.getFirstName(), VAADIN_ICON_LOGOUT, clickEvent -> {});
            loginHeader.addClassName("session-button");
            loginHeader.setIconAfterText(true);
            Anchor loginLink = new Anchor("logout", loginHeader);
            appLayout = AppLayoutBuilder.get(getVariant())
                    .withTitle(test)
                    .withIconComponent(logo)
                    .withAppBar(
                            AppBarBuilder.get()
                                    .add(loginLink)
                                    .build())
                    .withAppMenu(
                            LeftAppMenuBuilder.get()
                                    .addToSection(new LeftHeaderItem("Gestione del concorso", null,
                                            "/frontend/icons/icon-96.png"), HEADER)
                                    .add(new LeftNavigationItem(TITLE_HOME, VAADIN_ICON_HOME, HomeView.class))
                                    .add(new LeftNavigationItem(TITLE_EDITIONS, VAADIN_ICON_EDITIONS, EditionView.class))
                                    .add(new LeftNavigationItem(TITLE_STUDENTS, VAADIN_ICON_STUDENTS, StudentView.class))
                                    .add(new LeftNavigationItem(TITLE_RESULTS, VAADIN_ICON_RESULTS, ParticipationView.class))
                                    .add(LeftSubMenuBuilder.get("Comunicazioni", VAADIN_ICON_COMMUNICATIONS)
                                            .add(new LeftNavigationItem(TITLE_COMMUNICATIONS_DEFAULT, VaadinIcon.PAPERPLANE_O.create(), DefaultCommunicationsView.class))
                                            .add(new LeftNavigationItem(TITLE_COMMUNICATIONS_CUSTOM, VaadinIcon.PAPERPLANE_O.create(), CustomCommunicationsView.class))
                                            .build())
                                    .add(new LeftNavigationItem(TITLE_USERS, VAADIN_ICON_USERS, UserView.class))
                                    .add(new LeftNavigationItem(TITLE_REGISTER, VAADIN_ICON_REGISTER, RegisterPreView.class))
                                    .add(LeftSubMenuBuilder.get("Area Personale", VAADIN_ICON_PERSONAL)
                                            .add(new LeftNavigationItem(TITLE_PERSONAL_LOGIN, VaadinIcon.KEY.create(), LoginPersonalView.class))
                                            .add(new LeftNavigationItem(TITLE_PROFILE, VAADIN_ICON_PROFILE, ProfilePersonalView.class))
                                            .add(new LeftNavigationItem(TITLE_DECISIONS, VAADIN_ICON_DECISIONS, DecisionsPersonalView.class))
                                            .add(new LeftNavigationItem(TITLE_MESSAGES, VAADIN_ICON_MESSAGES, MessagesPersonalView.class))
                                            .build())
                                    .build())
                    .build();
        } else if (!SecurityUtils.isUserLoggedIn() && sdh.isStudentLoggedIn()) {
            loginHeader = new TopClickableItem("Staff", VaadinIcon.KEY.create(), clickEvent -> {});
            loginHeader.setIconAfterText(true);
            loginHeader.addClassName("session-button");
            Anchor loginLink = new Anchor("login", loginHeader);
            appLayout = AppLayoutBuilder.get(getVariant())
                    .withTitle(test)
                    .withIconComponent(logo)
                    .withAppBar(
                            AppBarBuilder.get()
                                    .add(loginLink)
                                    .build())
                    .withAppMenu(
                            LeftAppMenuBuilder.get()
                                    .addToSection(new LeftHeaderItem("Gestione del concorso", null,
                                            "/frontend/icons/icon-96.png"), HEADER)
                                    .add(new LeftNavigationItem(TITLE_HOME, VAADIN_ICON_HOME, HomeView.class))
                                    .add(new LeftNavigationItem(TITLE_REGISTER, VAADIN_ICON_REGISTER, RegisterPreView.class))
                                    .add(LeftSubMenuBuilder.get("Area Personale", VAADIN_ICON_PERSONAL)
                                            .add(new LeftNavigationItem(TITLE_PERSONAL_LOGIN, VaadinIcon.KEY.create(), LoginPersonalView.class))
                                            .add(new LeftNavigationItem(TITLE_PROFILE, VAADIN_ICON_PROFILE, ProfilePersonalView.class))
                                            .add(new LeftNavigationItem(TITLE_DECISIONS, VAADIN_ICON_DECISIONS, DecisionsPersonalView.class))
                                            .add(new LeftNavigationItem(TITLE_MESSAGES, VAADIN_ICON_MESSAGES, MessagesPersonalView.class))
                                            .build())
                                    .build())
                    .build();
        } else if (SecurityUtils.isUserLoggedIn() && !sdh.isStudentLoggedIn()) {
            SecurityUser principal = (SecurityUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
            loginHeader = new TopClickableItem(principal.getFirstName(), VAADIN_ICON_LOGOUT, clickEvent -> {});
            loginHeader.setIconAfterText(true);
            loginHeader.addClassName("session-button");
            Anchor loginLink = new Anchor("logout", loginHeader);

            appLayout = AppLayoutBuilder.get(getVariant())
                    .withTitle(test)
                    //.withTitle("TDS Webapp")
                    .withIconComponent(logo)
                    .withAppBar(
                            AppBarBuilder.get()
                                    .add(loginLink)
                                    .build())
                    .withAppMenu(
                            LeftAppMenuBuilder.get()
                                    .addToSection(new LeftHeaderItem("Gestione del concorso", null,
                                            "/frontend/icons/icon-96.png"), HEADER)
                                    .add(new LeftNavigationItem(TITLE_HOME, VAADIN_ICON_HOME, HomeView.class))
                                    .add(new LeftNavigationItem(TITLE_EDITIONS, VAADIN_ICON_EDITIONS, EditionView.class))
                                    .add(new LeftNavigationItem(TITLE_STUDENTS, VAADIN_ICON_STUDENTS, StudentView.class))
                                    .add(new LeftNavigationItem(TITLE_RESULTS, VAADIN_ICON_RESULTS, ParticipationView.class))
                                    .add(LeftSubMenuBuilder.get("Comunicazioni", VAADIN_ICON_COMMUNICATIONS)
                                            .add(new LeftNavigationItem(TITLE_COMMUNICATIONS_DEFAULT, VaadinIcon.PAPERPLANE_O.create(), DefaultCommunicationsView.class))
                                            .add(new LeftNavigationItem(TITLE_COMMUNICATIONS_CUSTOM, VaadinIcon.PAPERPLANE_O.create(), CustomCommunicationsView.class))
                                            .build())
                                    .add(new LeftNavigationItem(TITLE_USERS, VAADIN_ICON_USERS, UserView.class))
                                    .add(new LeftNavigationItem(TITLE_REGISTER, VAADIN_ICON_REGISTER, RegisterPreView.class))
                                    .add(new LeftNavigationItem(TITLE_PERSONAL_LOGIN, VaadinIcon.KEY.create(), LoginPersonalView.class))
                                    .build())
                    .build();

        } else {
            loginHeader = new TopClickableItem("Staff", VaadinIcon.KEY.create(), clickEvent -> {});
            loginHeader.setIconAfterText(true);
            loginHeader.addClassName("session-button");
            Anchor loginLink = new Anchor("login", loginHeader);
            appLayout = AppLayoutBuilder.get(getVariant())
                    .withTitle(test)
                    .withIconComponent(logo)
                    .withAppBar(
                            AppBarBuilder.get()
                                    .add(loginLink)
                                    .build())
                    .withAppMenu(
                            LeftAppMenuBuilder.get()
                                    .addToSection(new LeftHeaderItem("Gestione del concorso", null,
                                            "/frontend/icons/icon-96.png"), HEADER)
                                    .add(new LeftNavigationItem(TITLE_HOME, VAADIN_ICON_HOME, HomeView.class))
                                    .add(new LeftNavigationItem(TITLE_REGISTER, VAADIN_ICON_REGISTER, RegisterPreView.class))
                                    .add(new LeftNavigationItem(TITLE_PERSONAL_LOGIN, VaadinIcon.KEY.create(), LoginPersonalView.class))
                                    .build())

                    .build();
        }
        init((LeftLayouts.LeftResponsive) appLayout);
    }

    abstract Behaviour getVariant();
}
appreciated commented 5 years ago

Try the two following things:

  1. Checkout this answer
  2. Please checkout the working spring example,
  3. Your POM could use some cleaning up (but it looks fine). I recommend starting with a clean pom of the Vaadin 14 Spring boot starter.
  4. At least one of your dependencies will work no longer without compatibility mode (clipboardhelper)
lucastanzani commented 5 years ago

Thank you for you reply and work.

I tried both the answer you linked, and the spring example; none of both works: if i change the version number in the plain spring example to 4.0.0.beta2 (snapshot versionis not found), it gives exactly the same error. I noticed that if If i run mvm install before running the application, then the application runs; however to see each modification i would need to install it each time, and that would require too much time.

Thank you for your suggestions; I'll try the pom of the spring boot starter (however it should be quite similar to mine).

appreciated commented 5 years ago

@lucastanzani are you maybe running production mode by default? Also your vaadin-maven-plugin configuration goals are slightly different to the official example

slatequarry commented 5 years ago

I have the same problem with spring and 4.0.0.beta2 ! I created a small example from vaadin starter under https://github.com/slatequarry/vaadin-app-layout-spring-example ...

appreciated commented 5 years ago

@slatequarry Can you confirm that your example works if you execute vaadin:prepare-frontend before actually starting the application?

slatequarry commented 5 years ago

@slatequarry Can you confirm that your example works if you execute vaadin:prepare-frontend before actually starting the application?

Yes, it work !

appreciated commented 5 years ago

So this is actually not a bug but a "feature" 😅. I will make sure to throw a exception with a helpful message beforehand so that users know how to fix this issue

appreciated commented 5 years ago

The next version will have a more useful error message:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.appreciated.spring.MainAppLayout': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.appreciated.spring.MainAppLayout]: Constructor threw exception; nested exception is java.lang.IllegalStateException: The Behaviour could not be instantiated, this usually happens due to missing template files at runtime. Please make sure to run `mvn vaadin:prepare-frontend` before starting again!
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1303) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1197) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:305) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at com.vaadin.flow.spring.SpringInstantiator.getOrCreate(SpringInstantiator.java:117) ~[vaadin-spring-12.0.4.jar:na]
    at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:158) ~[flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget$1(AbstractNavigationStateRenderer.java:127) ~[flow-server-2.0.10.jar:2.0.10]
    at java.util.Optional.orElseGet(Optional.java:267) ~[na:1.8.0_211]
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:126) ~[flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.createChain(AbstractNavigationStateRenderer.java:316) ~[flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:195) ~[flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.router.Router.handleNavigation(Router.java:223) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.router.Router.navigate(Router.java:194) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.router.Router.initializeUI(Router.java:92) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.server.BootstrapHandler.createAndInitUI(BootstrapHandler.java:1420) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:456) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1540) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:246) [flow-server-2.0.10.jar:2.0.10]
    at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:95) [vaadin-spring-12.0.4.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) [javax.servlet-api-4.0.1.jar:4.0.1]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:352) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:645) [javax.servlet-api-4.0.1.jar:4.0.1]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) [spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) [javax.servlet-api-4.0.1.jar:4.0.1]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_211]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_211]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.22.jar:9.0.22]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_211]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.appreciated.spring.MainAppLayout]: Constructor threw exception; nested exception is java.lang.IllegalStateException: The Behaviour could not be instantiated, this usually happens due to missing template files at runtime. Please make sure to run `mvn vaadin:prepare-frontend` before starting again!
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1295) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 74 common frames omitted
Caused by: java.lang.IllegalStateException: The Behaviour could not be instantiated, this usually happens due to missing template files at runtime. Please make sure to run `mvn vaadin:prepare-frontend` before starting again!
    at com.github.appreciated.app.layout.component.applayout.Behaviour.getInstance(Behaviour.java:47) ~[classes/:na]
    at com.github.appreciated.app.layout.component.builder.AppLayoutBuilder.get(AppLayoutBuilder.java:27) ~[classes/:na]
    at com.github.appreciated.spring.MainAppLayout.<init>(MainAppLayout.java:39) ~[classes/:na]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_211]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_211]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_211]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_211]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    ... 76 common frames omitted
appreciated commented 5 years ago

@lucastanzani Does this also fix the issue for you?

appreciated commented 5 years ago

4.0.0.beta3 with the improved error message is out

lucastanzani commented 5 years ago

Unfortunately I am abroad for a few days. I will report as soon a I come back to work. Thank you anyway!

Inviato da iPhone

Il giorno 11 set 2019, alle ore 10:48, appreciated notifications@github.com ha scritto:

@lucastanzani Does this also fix the issue for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

lucastanzani commented 5 years ago

I can confirm it works!