You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SpringBoot项目no-hold执行mvn jetty:run-exploded时构建失败

Troubleshooting mvn jetty:run-exploded Errors for Your Spring Boot + Jetty WAR Project

Hey there, since your error log cuts off before showing the actual failure cause, let’s walk through the most common issues that trip up this command when running a Spring Boot Jetty WAR locally—especially for projects targeting Google App Engine.

1. Align Jetty Plugin Version with Spring Boot

The Jetty Maven plugin version you’re using (9.4.3.v20170317) might not play nice with the Jetty version your Spring Boot release depends on. Spring Boot has strict compatibility rules for embedded servers.

Fix: Use the Jetty version defined in Spring Boot’s dependency management. Update your pom.xml plugin section to pull the version from the BOM:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>${jetty.version}</version> <!-- This uses Spring Boot's recommended version -->
</plugin>

2. Make Sure Your Application Class Extends SpringBootServletInitializer

For WAR deployments (whether local Jetty or GAE), your main Spring Boot class needs to extend this class to let the servlet container (Jetty) bootstrap your app:

@SpringBootApplication
public class NoHoldApplication extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(NoHoldApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(NoHoldApplication.class, args);
    }
}

Skipping this step often leads to Jetty not finding your application context.

3. Exclude Tomcat Dependencies

Spring Boot’s starter-web includes Tomcat by default—you need to exclude it since you’re using Jetty instead. Otherwise, you’ll have conflicting server dependencies:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

4. Refresh Your Dependencies

Corrupted or missing jars can cause random startup failures. Run these commands to clean and rebuild your project:

mvn clean install

This ensures all dependencies are downloaded correctly and your WAR is built properly before running Jetty.

5. Get the Full Error Trace

Since your log was truncated, enable debug logging to see the complete stack trace—this will tell you exactly what’s breaking:

mvn jetty:run-exploded -X

Look for exceptions like ClassNotFoundException, BeanCreationException, or configuration errors in the debug output.

6. Double-Check GAE Configuration

If you’re deploying to Google App Engine, make sure:

  • Your app.yaml specifies the correct runtime (e.g., java17 if that’s what you’re using).
  • Your pom.xml is set to package as a WAR (<packaging>war</packaging>) and any GAE deployment plugins are configured correctly.

Once you have the full error message, you can zero in on the exact problem. For example, if it’s a missing class, check your dependencies; if it’s a bean issue, review your Spring config.

内容的提问来源于stack exchange,提问作者lucas johnston

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:32:35