如何在JBOSS EAP 6.4上运行Jhipster 5.4.0战争

时间:2018-10-19 20:39:43

标签: jboss jhipster jboss-eap-6

我们正在尝试在JBOSS EAP 6.4上部署jhipster应用, 我在使用JPA 2.1和VALIDATION 2时遇到了一些问题 问题是JBOSS是JAVA EE 6,但是jhipster使用了少量的JAVA EE 7功能。我们添加了jboss-deployment-structure.xml文件,以尝试避开某些模块。

现在我解决了JPA 2.1问题和验证,但仍然有问题。

这是 jboss-deployment-structure.xml

  <?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>

        <exclude-subsystems>
            <subsystem name="jpa" />


                <subsystem name="jaxrs"/>


        </exclude-subsystems>
        <exclusions>
            <!-- WFCORE-209 workaround -->
            <module name="javaee.api" />

            <module name="javax.persistence.api" />
            <module name="org.hibernate" />
            <module name="org.apache.log4j" />
            <module name="org.slf4j"/>
            <module name="org.apache.commons.logging"/>

            <module name="com.fasterxml.jackson.core.databind"/>
            <module name="com.fasterxml.jackson.module.afterburner"></module>

            <module name="com.fasterxml.jackson.databind.Module" />
            <module name="com.fasterxml.jackson.core.jackson-core" />
            <module name="com.fasterxml.jackson.core.jackson-annotations" />
            <module name="com.fasterxml.jackson.core.jackson-databind" />
            <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
            <module name="org.jboss.resteasy.resteasy-jackson2-provider" />
            <module name="org.jboss.resteasy.resteasy-jackson-provider" />
            <module name="com.fasterxml.jackson.datatype.jackson-datatype-jdk8" />
            <module name="com.fasterxml.jackson.datatype.jackson-datatype-jsr310" />


            <module name="javax.persistence.api" />
            <module name="org.hibernate" />
            <module name="org.hibernate.javax.persistence" />
            <module name="org.hibernate.validator" />
            <module name="javax.validation.api" />
            <module name="javax.el"/>
            <module name="javax.faces.api"/>
            <module name="org.hibernate.validator"/>

        </exclusions>


        <dependencies>
            <!-- WFCORE-209 workaround -->

          <!--  <module name="javax.validation.api" export="true"/>
          -->
            <!-- This one always goes last. -->
           <!-- <module name="javax.api" >
            <imports>
                <exclude-set>
                    <path name="javax/ws/rs"/>
                    <path name="javax/ws/rs/core"/>
                    <path name="javax/ws/rs/ext"/>
                    <path name="javax/validation"/>
                    <path name="javax/validation/bootstrap"/>
                    <path name="javax/validation/constraints"/>
                    <path name="javax/validation/groups"/>
                    <path name="javax/validation/metadata"/>
                    <path name="javax/validation/spi"/>
                </exclude-set>

            </imports>
            </module>-->
        </dependencies>

    </deployment>
</jboss-deployment-structure>

这是最后一个错误

  

原因:java.lang.IllegalAccessError:javax / el / ELUtil       在javax.el.E​​LManager.getExpressionFactory(ELManager.java:61)[javax.el-3.0.0.jar:3.0.0]       在org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:88)处[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator处。(ResourceBundleMessageInterpolator.java:47)[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolator(ConfigurationImpl.java:474)处[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolatorConfiguredWithClassLoader(ConfigurationImpl.java:650)处[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在org.hibernate.validator.internal.engine.ConfigurationImpl.getMessageInterpolator(ConfigurationImpl.java:397)上[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在org.hibernate.validator.internal.engine.ValidatorFactoryImpl。(ValidatorFactoryImpl.java:183)[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38)[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:364)上[hibernate-validator-6.0.12.Final.jar:6.0.12.Final]       在javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:103)处[validation-api-2.0.1.Final.jar:]       在org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:501)上[hibernate-core-5.2.17.Final.jar:5.2.17.Final]       org.hibernate.cfg.beanvalidation.TypeSafeActivator.activate(TypeSafeActivator.java:84)[hibernate-core-5.2.17.Final.jar:5.2.17.Final]       在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处[rt.jar:1.8.0_31]       在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[rt.jar:1.8.0_31]       在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[rt.jar:1.8.0_31]       在java.lang.reflect.Method.invoke(Method.java:483)[rt.jar:1.8.0_31]       在org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:132)[hibernate-core-5.2.17.Final.jar:5.2.17.Final]

1 个答案:

答案 0 :(得分:1)

尝试将休眠验证器从版本6更改为版本5。

1)从spring-boot-starter-web中排除休眠验证器:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
        </exclusion>
    </exclusions>
</dependency>

2)添加休眠验证器版本5:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>5.4.2.Final</version>
</dependency>

我使用jhipster 5.6.1的应用程序可以使用此方法。我从spring-boot文档中阅读了有关LocalValidatorFactoryBean的兼容性。我正在使用eap 6.4.8