通过Docker将Nexus war部署到Wildfly时出现部署错误
问题:Docker部署Nexus War包至Wildfly服务器失败
部署过程中出现如下错误日志:
2024-02-07 14:52:45,828 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: (["deployment" => "file.war"]) - failure description: { "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"file.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of file\"file.war\" Caused by: java.lang.UnsupportedClassVersionError: Failed to link com/vaadin/flow/component/grid/ColumnGroup (Module \"deployment.file.war\" from Service Module Loader): com/vaadin/flow/component/grid/ColumnGroup has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0"}, "WFLYCTL0412: Required services that are not installed:" => [ "jboss.deployment.unit.\"file.war\".WeldStartService", "jboss.deployment.unit.\"file.war\".beanmanager" ], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.deployment.unit.\"file.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"file.war\".WeldStartService, jboss.deployment.unit.\"file.war\".beanmanager]", "jboss.deployment.unit.\"file.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"file.war\".beanmanager]" ] }
当前环境详情
- JDK版本:8
- Wildfly版本:15.0.1.Final
- MSSQL JDBC版本:12.4.2.jre8
解决方案
核心问题分析
错误日志中java.lang.UnsupportedClassVersionError是关键:com/vaadin/flow/component/grid/ColumnGroup的class文件版本为55.0(对应Java 11),但当前运行环境的JDK 8仅支持最高52.0的class版本,导致类加载失败,进而引发后续服务依赖缺失问题。
解决步骤
升级JDK版本:
将Wildfly运行环境的JDK从8升级到Java 11或更高版本,Wildfly 15.0.1.Final官方支持Java 8到Java 11,升级到Java 11可直接兼容目标类版本。适配War包编译版本:
若无法升级JDK,需重新编译Nexus War包,编译时指定目标JDK为8(添加-target 1.8编译参数),确保生成的class文件版本与运行环境兼容。同步依赖版本:
若升级JDK到11,需将MSSQL JDBC驱动更换为对应jre11版本(如mssql-jdbc-12.4.2.jre11.jar),避免依赖不兼容问题。
内容的提问来源于stack exchange,提问作者MSH
相关产品推荐
相关产品推荐

