Grails 3.1.5, Hibernate 5, на JBoss выбрасывает NoSuchMethodError org.jboss.logging.Logger.debugf
В Grails 3.1.5 с плагином Hibernate5 я не могу развернуть в JBoss EAP 6.4.0.GA.
Я получил:
NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
Я считаю, что проблема заключается в том, что Hibernate 5 зависит от jboss-logging 3, и хотя я включил jboss-logging 3 в мой файл build.gradle, при развертывании в JBoss я думаю, что он все еще использует более раннюю версию jboss- ведение журнала, которое не включает новые методы "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-logging от добавления в ваше развертывание. С EAP 6.4 вы можете установить атрибут в подсистеме регистрации, который будет влиять на все развертывания. Изменить add-logging-api-dependencies
приписывать false
и включите версию jboss-logging, требуемую в вашем развертывании.
/subsystem=logging:write-attribute(name=add-logging-api-dependencies, value=false)
Если вы хотите, чтобы только одно развертывание игнорировало зависимость, вы можете использовать jboss-deployment-structure.xml
исключить зависимость или подсистему регистрации.