JavaEE新手Maven部署WildFly时war包部署失败问题求助
Hey there, let's break down this deployment issue you're facing with WildFly and your Maven-built Java EE project. I've helped plenty of new devs work through similar problems, so let's take this step by step.
Your server log points to two critical failures that are stopping deployment:
service jboss.deployment.unit."com.nada.jar".POST_MODULE: This jar is failing during the POST_MODULE phase—usually this means there's a dependency missing, a class loading conflict, or the jar itself is corrupted/misconfigured.service jboss.deployment.subunit."coivoiturage-ear.ear"."coivoiturage-web.war".INSTALL: The WAR inside your EAR is failing to install, and this is almost certainly a side effect of thecom.nada.jarissue (since the WAR likely depends on this jar).
com.nada.jar first (it's the root cause) Let's start with the jar that's throwing the initial error:
- Check if the jar exists and is correctly packaged
- Look in your project's
targetdirectory, or inside the EAR'slibfolder (if it's supposed to be bundled there) to confirmcom.nada.jaris present. If it's missing, double-check your Maven pom.xml: maybe the dependency forcom.nadais marked asprovidedwhen it should becompile, or it's not being included in the EAR/WAR build.
- Look in your project's
- Validate the jar's contents
- Unzip the jar and check for missing classes, broken entries in
MANIFEST.MF, or invalid configuration files (likepersistence.xmlorbeans.xmlif it's a CDI-enabled jar).
- Unzip the jar and check for missing classes, broken entries in
- Spot classpath conflicts
- WildFly comes with its own versions of common Java EE libraries (like servlet API, JPA, etc.). If
com.nada.jarincludes a library that clashes with WildFly's built-in one, that'll trigger a POST_MODULE failure. Runmvn dependency:treein your project root to list all dependencies and spot duplicates or conflicts.
- WildFly comes with its own versions of common Java EE libraries (like servlet API, JPA, etc.). If
Since you're deploying an EAR that contains a WAR, make sure the packaging setup is correct:
- Verify your
application.xml- If your project uses an
application.xml(located insrc/main/application/META-INF), confirm it correctly listscom.nada.jaras an EJB module and the WAR as a web module. Here's an example of a valid entry:<module> <ejb>com.nada.jar</ejb> </module> <module> <web> <web-uri>coivoiturage-web.war</web-uri> <context-root>/coivoiturage</context-root> </web> </module>
- If your project uses an
- Check your Maven EAR plugin setup
- In your EAR project's pom.xml, ensure the Maven EAR plugin is configured to include all required modules. Example configuration:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ear-plugin</artifactId> <version>3.3.0</version> <configuration> <modules> <ejbModule> <groupId>com.yourgroup</groupId> <artifactId>com.nada</artifactId> </ejbModule> <webModule> <groupId>com.yourgroup</groupId> <artifactId>coivoiturage-web</artifactId> <contextRoot>/coivoiturage</contextRoot> </webModule> </modules> </configuration> </plugin>
- In your EAR project's pom.xml, ensure the Maven EAR plugin is configured to include all required modules. Example configuration:
Sometimes the wildfly:deploy plugin hides detailed errors—try deploying manually to get clearer feedback:
- Run
mvn clean packageto build your EAR file (it'll be in thetargetdirectory). - Log into WildFly's admin console (usually at
http://localhost:9990), navigate to Deployments, and upload the EAR file. The console will show real-time, detailed error messages that might be missing from your truncated server.log.
If the existing logs aren't enough to pinpoint the issue, turn on debug logging for WildFly's deployment subsystem:
- Edit
standalone/configuration/standalone.xml(ordomain.xmlif using domain mode) and add this logger to the logging subsystem:<logger category="org.jboss.as.deployment"> <level name="DEBUG"/> </logger> - Restart WildFly and redeploy. The debug logs will show exactly what's happening during the POST_MODULE and INSTALL phases, making it easier to fix the root problem.
- Double-check that WildFly is running before you run
wildfly:deploy—it sounds obvious, but this trips up a lot of new folks. - Ensure no other process is using WildFly's default ports (8080, 9990). If ports are occupied, WildFly might not start properly, leading to deployment failures.
- Clean your Maven repository: Corrupted dependencies can cause weird issues. Run
mvn clean install -Uto force update dependencies and rebuild your project from scratch.
内容的提问来源于stack exchange,提问作者Dach Ch

