我从示例中创建了一个准系统项目,导师让我在WildFly上运行。每当我运行服务器时,我都会收到错误:
[org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "mysql-connector-java-5.1.39-bin.jar")]) - failure description: "WFLYSRV0137: No deployment content with hash 3ab47e0f358f83fa29c2b3ba8106c0cc016e1198 is available in the deployment content repository for deployment 'mysql-connector-java-5.1.39-bin.jar'. This is a fatal boot error. To correct the problem, either restart with the --admin-only switch set and use the CLI to install the missing content or remove it from the configuration, or remove the deployment from the xml configuration file and restart."
我的pom.xml
看起来像这样:
<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>BrassDucks</groupId>
<artifactId>BrassDucks</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<description>Brass Ducks</description>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1-m01</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.ejb/ejb-api -->
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
虽然我不认为这些与ApplicationConfig.java
:
package brass.ducks.application;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/")
public class ApplicationConfig extends Application {}
我的Controller.java
看起来像这样:
package brass.ducks.controller;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public class Controller {
private final static Logger log = LoggerFactory.getLogger(Controller.class);
@GET
@Path("hello")
public String listStaff() {
return "hello";
}
}
如何解决此错误?
答案 0 :(得分:0)
我认为在mysql驱动程序上遇到某种版本冲突。
理想情况下,您应该安装并使用正确版本的mysql驱动程序作为模块。您可以使用maven插件安装它或手动创建模块:
一旦你的pom.xml中的mysql驱动程序版本和wildfly中配置的版本一致,你的错误就会消失。