2016-09-26 306 views
0

我從一個導師給我在WildFly上運行的例子創建一個準系統項目。每當我運行服務器我得到的錯誤:JBoss錯誤:org.jboss.as.controller.management-operation使用mysql-connector-java-5.1.39-bin.jar

[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

我認爲在mysql驅動程序上會出現某種版本衝突。

理想情況下,您應該安裝並使用正確版本的mysql驅動程序作爲模塊。您可以使用Maven插件安裝或手動創建一個模塊:

一旦你的POM版本MySQL驅動的。 xml和野蠻人配置的是一致的,你的錯誤應該消失。