2016-04-18 80 views
0

在帶有Hibernate5插件的Grails 3.1.5中,我無法部署到JBoss EAP 6.4.0.GA.在JBoss上拋出的Grails 3.1.5,Hibernate 5 NoSuchMethodError org.jboss.logging.Logger.debugf

我得到:

NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V 

我相信這個問題是因爲Hibernate 5在我的build.gradle文件3,即使我已經包括JBoss上,記錄的依賴JBoss的日誌記錄3,當我部署到JBoss我認爲它仍然使用早期版本的jboss-logging,它不包含新的「f」方法,即debugf()。

如何獲得Grails 3和Hibernate 5應用程序在JBoss EAP 6.4.0上成功部署?

我的build.gradle文件是:

buildscript { 
    ext { 
     grailsVersion = project.grailsVersion 
    } 
    repositories { 
     mavenLocal() 
     maven { url "https://repo.grails.org/grails/core" } 
    } 
    dependencies { 
     classpath "org.grails:grails-gradle-plugin:$grailsVersion" 
     classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.5.0" 
     classpath "org.grails.plugins:hibernate5:5.0.4" 
     classpath "org.grails.plugins:views-gradle:1.0.4" 
     classpath "org.jboss.logging:jboss-logging:3.3.0.Final" 
    } 
} 

version ... 
group ... 

apply plugin:"eclipse" 
apply plugin:"idea" 
apply plugin: "war" 
apply plugin: "org.grails.grails-web" 
apply plugin: "org.grails.grails-gsp" 
apply plugin:"asset-pipeline" 
apply plugin: "org.grails.plugins.views-json" 

ext { 
    grailsVersion = project.grailsVersion 
    gradleWrapperVersion = project.gradleWrapperVersion 
} 

repositories { 
    mavenLocal() 
    maven { url "https://repo.grails.org/grails/core" } 
} 

dependencyManagement { 
    imports { 
     mavenBom "org.grails:grails-bom:$grailsVersion" 
    } 
    applyMavenExclusions false 
} 

dependencies { 
    compile "org.springframework.boot:spring-boot-starter-logging" 
    compile "org.springframework.boot:spring-boot-autoconfigure" 
    compile "org.grails:grails-core" 
    compile "org.springframework.boot:spring-boot-starter-actuator" 
    provided "org.springframework.boot:spring-boot-starter-tomcat" 
    testCompile "org.springframework.boot:spring-boot-starter-tomcat" 
    compile "org.grails:grails-dependencies" 
    compile "org.grails:grails-web-boot" 
    compile "org.grails.plugins:cache" 
    compile "org.grails.plugins:scaffolding" 
    compile "org.grails.plugins:views-json" 

    compile "org.grails.plugins:hibernate5" 
    testCompile "org.grails.plugins:hibernate5" 
    compile "org.hibernate:hibernate-core:5.1.0.Final" 
    compile "org.hibernate:hibernate-ehcache:5.1.0.Final" 

    console "org.grails:grails-console" 
    profile "org.grails.profiles:web:3.1.5" 
    runtime "org.grails.plugins:asset-pipeline" 
    runtime "com.h2database:h2" 

    runtime files('grails-app/lib/ojdbc7.jar', 'grails-app/lib/xdb6.jar') 
    compile files('grails/src/java') 

    testCompile "org.grails:grails-plugin-testing" 
    testCompile "org.grails.plugins:geb" 

    testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:2.52.0" 
    testRuntime "org.seleniumhq.selenium:selenium-support:2.52.0" 

    console "org.grails:grails-console" 

    runtime "org.jboss.logging:jboss-logging:3.3.0.Final" 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = gradleWrapperVersion 
} 

assets { 
    minifyJs = false // This will probably break dependency injection in our AngularJs artifacts that use DI. 
    minifyCss = true 
} 

回答

1

的JBoss EAP 6.4使用Hibernate 4.x版我不會建議混合JPA提供者的版本。您可能需要從部署中排除JPA子系統,以確保不包含Hibernate 4依賴項。您可能需要明確排除JPA API依賴項,因爲EAP 6是Java EE 6容器,而Hibernate 5是用於JPA 2.1(屬於Java EE 7的一部分)。

如果您已經整理出這些問題,還需要排除jboss日誌依賴性被添加到您的部署。使用EAP 6.4,您可以在日誌子系統中設置一個影響所有部署的屬性。將add-logging-api-dependencies屬性更改爲false,幷包含部署中所需的jboss日誌記錄版本。

/subsystem=logging:write-attribute(name=add-logging-api-dependencies, value=false) 

如果你只想要一個部署忽略的依賴,那麼你可以使用一個jboss-deployment-structure.xml排除依賴或記錄子系統。

相關問題