部署因 wildfly gradle 和休眠而失败

Deployment fails with wildfly gradle and hibernate

我无法部署简单的 Hello World 示例 *.war。 Wildfly 不会找到 hibernate Session 类 吗? 我的项目使用 gradle 设置(见附件 build.gradle)。

我找不到任何关于 gradle 应该如何与 Wildfly 提供的一般库结合使用的明确文档。 欢迎任何提示。

野蝇日志:

 Caused by: java.lang.ClassNotFoundException: org.hibernate.Session from [Module "deployment.myshop-1.0.war:main" from Service Module Loader]
  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
  ... 15 more


[0m [31m13:05:02,682 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "myshop-1.0.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myshop-1.0.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myshop-1.0.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"myshop-1.0.war\"
    Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.mycorp.common.dao.HelloDao with ClassLoader ModuleClassLoader for Module \"deployment.myshop-1.0.war:main\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: Lorg/hibernate/Session;
    Caused by: java.lang.ClassNotFoundException: org.hibernate.Session from [Module \"deployment.myshop-1.0.war:main\" from Service Module Loader]"}}
[0m [31m13:05:02,683 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "myshop-1.0.war" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myshop-1.0.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myshop-1.0.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"myshop-1.0.war\"
    Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.mycorp.common.dao.HelloDao with ClassLoader ModuleClassLoader for Module \"deployment.myshop-1.0.war:main\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: Lorg/hibernate/Session;
    Caused by: java.lang.ClassNotFoundException: org.hibernate.Session from [Module \"deployment.myshop-1.0.war:main\" from Service Module Loader]"}}
[0m [0m13:05:02,685 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015877: Stopped deployment myshop-1.0.war (runtime-name: myshop-1.0.war) in 2ms
[0m [0m13:05:02,686 INFO  [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."myshop-1.0.war".POST_MODULE

build.gradle:

version = '1.0'

apply plugin: 'java'
   apply plugin: 'idea'
apply plugin: 'war'

sourceCompatibility = 1.8
   targetCompatibility = 1.8


   repositories {
  mavenLocal()
  maven {
  url 'http://repository.jboss.org/nexus/content/groups/public'
   }
  mavenCentral()
  }

  dependencies {

  providedCompile "javax.validation:validation-api:1+"

   providedCompile "org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_1.1_spec:1+"
   providedCompile "org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:1+"
   providedCompile "org.jboss.resteasy:resteasy-jaxrs:3+"

   providedCompile "org.hibernate:hibernate-core:4+"
   providedCompile "org.hibernate:hibernate-entitymanager:4+"
   providedCompile "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1+"

   providedCompile "postgresql:postgresql:9+"
   /*providedCompile "postgresql:postgresql:9.1-901.jdbc4"*/

   testCompile group: 'junit', name: 'junit', version: '4.11'
   testCompile "org.hamcrest:hamcrest-all:1+"
   testCompile "org.mockito:mockito-core:1+"
   }

我的问题在wildfly论坛得到了解答

https://developer.jboss.org/thread/251633