spring-boot - 将 Spring Boot 项目部署到 Wildfly 时出现 Weld DefinitionException
问题描述
我正在尝试将 WildFly 用于我的 Spring Boot 项目,但是当我部署它时,会引发以下异常:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"infrendsz-0.0.1-SNAPSHOT.war\".WeldStartService" => "Failed to start service
Caused by: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
Exception 0 :
javax.enterprise.event.ObserverException
...
Caused by: java.lang.ExceptionInInitializerError
...
Caused by: java.lang.reflect.MalformedParameterizedTypeException
...
"}}
该项目可以作为普通的 Spring Boot 项目正常工作。
我正在使用 WildFly 11。
我做了这里写的一切: https ://thepracticaldeveloper.com/2017/09/02/how-to-deploy-a-spring-boot-war-in-wildfly-jboss/
此外,我的项目根本不使用 Spring Security,但我需要将其添加到依赖项中,否则 WildFly 会抛出 ClassDefNotFound 异常。
这是我的 pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hu.kleatech</groupId>
<artifactId>infrendsz</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>infrendsz</name>
<description>Információs rendszerek építése tárgy beadandó</description>
<parent>
<groupId>org.joinfaces</groupId>
<artifactId>joinfaces-parent</artifactId>
<version>3.2.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>jsf-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<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-security</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!--
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
-->
</project>
你知道这是什么原因以及如何解决它吗?
解决方案
推荐阅读
- javascript - 当返回的 JSON 中有双引号时,JavaScript 会中断
- docker - 如何获取 influxdb docker 镜像来初始化石墨和电报
- python - 仅有效计算对称外积矩阵的唯一元素
- python-2.7 - 在 python 中使用 pynput 函数通过 SSH 向树莓派 pi3 进行键盘输入
- android - 在 SharedPreferences 中分组键值对
- jenkins - 工件 [testart] 中不存在文件 [imagedefinitions.json] - AWS CodePipeline - Jenkins
- angularjs - angularjs 默认页面,无需键入 index.html
- rxjs - 将旧的 httpGet 转换为 Pipeable 运算符
- r - 在 R 中的逐步回归中约束预测变量的数量
- python - 如何用我的两个微分方程显示曲线?