Search code examples
springspring-bootdeploymentwebsphere-libertyvaadin-flow

Error deploying vaadin flow starter application to WebSphere Liberty


I am trying to deploy the Vaadin's starter project to Liberty server as war, but im getting an error. I did not change either the project or the server settings so you can replicate my issue.
(You can see the details below)

Liberty server: WebSphere Liberty Web Profile 8 21.0.0.6

Starter project: https://start.vaadin.com/app?dl&preset=latest

Current versions:

<properties>
        <java.version>8</java.version>
        <vaadin.version>20.0.2</vaadin.version>
</properties>

Error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'vaadinApplicationContextInitializer' defined in class path resource [com/vaadin/flow/spring/VaadinApplicationConfiguration.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: javax.servlet.ServletException: java.lang.reflect.InvocationTargetException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:610) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.6.jar:5.3.6]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.6.jar:5.3.6]
.
.
.
Unable to find a single class implementing `AppShellConfigurator` from the following candidates:
  com.example.application.Application
  com.vaadin.flow.component.page.AppShellConfigurator

    at com.vaadin.flow.server.AppShellRegistry.setShell(AppShellRegistry.java:140) ~[flow-server-7.0.2.jar:7.0.2]
    at com.vaadin.flow.server.startup.VaadinAppShellInitializer.lambda$init$1(VaadinAppShellInitializer.java:134) ~[flow-server-7.0.2.jar:7.0.2]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:1.8.0_211]
    at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:352) ~[na:1.8.0_211]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[na:1.8.0_211]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_211]
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[na:1.8.0_211]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:1.8.0_211]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_211]
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[na:1.8.0_211]
    at com.vaadin.flow.server.startup.VaadinAppShellInitializer.init(VaadinAppShellInitializer.java:132) ~[flow-server-7.0.2.jar:7.0.2]
    at com.vaadin.flow.server.startup.VaadinAppShellInitializer.initialize(VaadinAppShellInitializer.java:79) ~[flow-server-7.0.2.jar:7.0.2]
    at com.vaadin.flow.server.startup.VaadinServletContextStartupInitializer.process(VaadinServletContextStartupInitializer.java:42) ~[flow-server-7.0.2.jar:7.0.2]
    ... 48 common frames omitted

When I tried to debug, I've noticed that the VaadinAppShellInitializer.init methods "classes" parameter contains the following:

  1. "interface com.vaadin.flow.component.page.AppShellConfigurator"
  2. "class com.example.application.views.helloworld.HelloWorldView"
  3. "interface com.vaadin.flow.server.PageConfigurator"
  4. "class com.example.application.views.about.AboutView"
  5. "class com.example.application.Application"

As i see the two interface entry causes the problems, but i couldnt find a solution to get rid of them.


Solution

  • Here is the guide that helped me : Deploying a Spring Boot Application with open liberty

    1. I had to install springBoot-2.0 feature to liberty
    2. I had to configure my server.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <server description="new server">
        <featureManager>
            <feature>servlet-4.0</feature>
            <feature>springBoot-2.0</feature>
        </featureManager>
        <httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443"/>
        <springBootApplication id="guide-spring-boot" location="myapp-1.0-SNAPSHOT.war" name="guide-spring-boot"/>
    </server>