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

从IntelliJ导出WAR包部署到Heroku遇应用错误求助

Troubleshooting Heroku Deployment Error with IntelliJ-Exported WAR

First things first—let’s get the actual error details instead of guessing. Heroku’s generic "Application error" message doesn’t tell us much, so run this command to pull your app’s live logs:

heroku logs --tail --app <app-name>

This will show you the exact stack trace or failure reason, which is critical for narrowing down the issue. Since you suspect IntelliJ’s WAR export is the culprit, let’s focus on that angle first:

Common IntelliJ WAR Export Issues & Fixes

  • Missing runtime dependencies: IntelliJ’s artifact configuration sometimes excludes certain runtime libraries by default. To fix this:
    1. Go to File > Project Structure > Artifacts
    2. Select your WAR artifact, then check the Available Elements pane
    3. Ensure all required libraries (like database drivers, framework JARs) are added to the WEB-INF/lib folder of the artifact
    4. Re-export the WAR and redeploy
  • Incorrect environment configuration: If your app uses environment-specific config files (like application-dev.properties vs application-prod.properties), IntelliJ might be packaging the dev version instead of the one compatible with Heroku. Double-check your artifact settings to make sure the production config is included, and verify that Heroku’s environment variables (like DATABASE_URL) are correctly referenced in your config.
  • JDK version mismatch: Heroku uses a default Java version (often 8 or 11) that might not match what you’re using in IntelliJ. To align them:
    1. Create a system.properties file in your project root
    2. Add a line like java.runtime.version=17 (replace with your local JDK version)
    3. Commit this file to your repo and redeploy
  • Corrupted build cache: IntelliJ’s build cache can sometimes produce faulty WARs. Try:
    1. Running Build > Clean Project
    2. Deleting the existing artifact (Project Structure > Artifacts > Delete)
    3. Re-creating the WAR artifact from scratch
    4. Exporting and redeploying the fresh WAR

Quick Validation Step

Before redeploying, extract your IntelliJ-exported WAR file locally and compare the WEB-INF/lib folder with the libraries your local Tomcat uses to run the app. If any critical JARs are missing in the WAR, that’s almost certainly the problem.

If after checking all these the issue persists, share the specific error lines from your Heroku logs—we can dig deeper from there!

内容的提问来源于stack exchange,提问作者Stefano Ferrario

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.07 08:52:49