Unable to start a Spring application using `jetty-maven-plugin`: server stops without errors

281 Views Asked by At

I started a few months ago to maintain an old Spring project (Wisemapping) using the Jetty Maven plugin. I'm currently trying to port it to Java 11 but Jetty silently fails and stops the server as soon as Maven build has suceeded. Here is the end of the Maven log:

[INFO] Scanning elapsed time=3502ms
[INFO] DefaultSessionIdManager workerName=node0
[INFO] No SessionScavenger set, using defaults
[INFO] node0 Scavenging every 660000ms
[INFO] Initializing Spring root WebApplicationContext
2020-10-13 14:21:15,318 WARN org.springframework.security.core.SpringSecurityCoreVersion - **** You are advised to use Spring 5.2.6.RELEASE or later with this version. You are running: 5.2.3.RELEASE
2020-10-13 14:21:15,318 WARN org.springframework.security.core.SpringSecurityCoreVersion - **** You are advised to use Spring 5.2.6.RELEASE or later with this version. You are running: 5.2.3.RELEASE
2020-10-13 14:21:19,071 WARN org.openid4java.server.RealmVerifier - RP discovery / realm validation disabled; 
[INFO] Initializing Spring DispatcherServlet 'mvc-rest'
[INFO] Initializing Spring DispatcherServlet 'mvc-servlet'
[INFO] Started o.e.j.m.p.JettyWebAppContext@7d06a187{/,[file:///****/wisemapping-open-source/wise-webapp/target/jetty_overlays/wise-editor-5_0_0-SNAPSHOT_war/, file:///****/wisemapping-open-source/wise-webapp/src/main/webapp/],AVAILABLE}{file:///****/wisemapping-open-source/wise-webapp/src/main/webapp/}
[INFO] Started ServerConnector@4ce65fa4{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[INFO] Started @20129ms
[INFO] Started Jetty Server
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.712 s
[INFO] Finished at: 2020-10-13T14:21:21+02:00
[INFO] ------------------------------------------------------------------------
[INFO] node0 Stopped scavenging
[INFO] Stopped o.e.j.m.p.JettyWebAppContext@7d06a187{/,[file:///****/wisemapping-open-source/wise-webapp/target/jetty_overlays/wise-editor-5_0_0-SNAPSHOT_war/, file:///****/wisemapping-open-source/wise-webapp/src/main/webapp/],STOPPED}{file:///****/wisemapping-open-source/wise-webapp/src/main/webapp/}
[INFO] Stopped ServerConnector@4ce65fa4{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[WARNING] java.nio.channels.ClosedSelectorException
[WARNING] java.nio.channels.ClosedSelectorException
[WARNING] java.nio.channels.ClosedSelectorException
[WARNING] java.nio.channels.ClosedSelectorException

While enabling debug mode displays a NoClassDefFoundError, it seems totally unrelated (see this other Stackoverflow question).

Here is the plugin configuration:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>${jetty-maven-plugin.version}</version>
    <configuration>
        <stopKey>foo</stopKey>
        <nonBlocking>true</nonBlocking>
        <stopPort>9999</stopPort>
        <war>${project.build.directory}/wisemapping.war</war>
        <reload>automatic</reload>
        <systemProperties>
            <systemProperty>
                <name>org.mortbay.util.FileResource.checkAliases</name>
                <value>false</value>
            </systemProperty>
            <systemProperty>
                <name>org.mortbay.util.FileResource.checkAliases</name>
                <value>false</value>
            </systemProperty>
            <systemProperty>
                <name>database.base.url</name>
                <value>${project.build.directory}</value>
            </systemProperty>
        </systemProperties>
        <webApp>
            <overrideDescriptor>${project.basedir}/webdefault.xml</overrideDescriptor>
            <baseAppFirst>false</baseAppFirst>
        </webApp>
    </configuration>
    <executions>
        <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
        <execution>
            <id>stop-jetty</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
</plugin>

I'm using version 9.4.32.v20200930 but I'm able to reproduce it on several 9.x version of the plugin. I managed to correctly start the app on version 10 and 11 of the plugin and I would use them but docuamentation is not published yet.

I have no clue as to where to search for problems or misconfigurations.

0

There are 0 best solutions below