Grails 3.1.5,Hibernate 5,在 JBoss 上抛出 NoSuchMethodError org.jboss.logging.Logger.debugf
Grails 3.1.5, Hibernate 5, on JBoss throw NoSuchMethodError org.jboss.logging.Logger.debugf
在带有 Hibernate5 插件的 Grails 3.1.5 中,我无法部署到 JBoss EAP 6.4。0.GA。
我得到:
NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
我认为问题是因为 Hibernate 5 依赖于 jboss-logging 3,即使我在我的 build.gradle 文件中包含了 jboss-logging 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
}
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
来排除依赖项或日志子系统。
在带有 Hibernate5 插件的 Grails 3.1.5 中,我无法部署到 JBoss EAP 6.4。0.GA。
我得到:
NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
我认为问题是因为 Hibernate 5 依赖于 jboss-logging 3,即使我在我的 build.gradle 文件中包含了 jboss-logging 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
}
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
来排除依赖项或日志子系统。