代码之家  ›  专栏  ›  技术社区  ›  Junior Bezerra

部署Jboss产品

  •  0
  • Junior Bezerra  · 技术社区  · 7 年前

    我使用的是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。坚持不懈桌子Index()[Ljavax/persistence/Index; 组织。springframework。豆子。工厂BeanCreationException:错误 创建在类路径中定义的名为“entityManagerFactory”的bean 资源

    1 回复  |  直到 7 年前
        1
  •  0
  •   Venu Duggireddy    7 年前

    JBoss EAP 6.4还不支持Hibernate 5,并且与JPA版本冲突。

    降级到Hibernate 4这可以通过添加Hibernate来实现。pom中的版本属性。xml

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

    然后创建一个新的jboss部署结构。META-INF目录下的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>
    

    `