部署Jboss Prod

时间:2018-03-12 12:32:50

标签: spring-boot jboss spring-data spring-data-jpa

我使用的是spring boot,我的应用程序服务器是Jboss。

<dependency>
   <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.7.RELEASE:compile
  org.springframework.boot:spring-boot-starter-aop:jar:1.5.7.RELEASE:compile
   org.aspectj:aspectjweaver:jar:1.8.10:compile
  org.hibernate:hibernate-core:jar:5.0.12.Final:compile
    org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
    org.javassist:javassist:jar:3.21.0-GA:compile
    antlr:antlr:jar:2.7.7:compile
    org.jboss:jandex:jar:2.0.0.Final:compile
    dom4j:dom4j:jar:1.6.1:compile
    org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
  org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile
  javax.transaction:javax.transaction-api:jar:1.2:compile
  org.springframework.data:spring-data-jpa:jar:1.11.7.RELEASE:compile
    org.springframework.data:spring-data-commons:jar:1.13.7.RELEASE:compile
    org.springframework:spring-orm:jar:4.3.11.RELEASE:compile
  org.springframework:spring-aspects:jar:4.3.11.RELEASE:compile

当我在生产中启动我的应用程序时,我收到以下错误:

  

引起:java.lang.NoSuchMethodError:   javax.persistence.Table.indexes()[Ljavax /持久/索引;   org.springframework.beans.factory.BeanCreationException:错误   创建名为&entityManagerFactory&#39;的bean在类路径中定义   资源

1 个答案:

答案 0 :(得分:0)

JBoss EAP 6.4尚不支持Hibernate 5,也与JPA版本冲突。

降级到Hibernate 4这可以通过在pom.xml中添加hibernate.version属性来实现

<properties> <hibernate.version>4.3.11.Final</hibernate.version> </properties>

然后在META-INF目录下创建一个新的jboss-deployment-structure.xml文件并复制到内容下面并尝试

<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="jpa"/>
        </exclude-subsystems>
        <exclusions>
            <module name="javaee.api"/>
        </exclusions>
        <dependencies>
            <module name="javax.annotation.api" export="true"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

`