运行 Jhipster 5.4.0 如何在 JBOSS EAP 6.4 上 war
How Run Jhipster 5.4.0 war on JBOSS EAP 6.4
我们正在尝试在 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-部署-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>
这是最后一个错误
Caused by: java.lang.IllegalAccessError: javax/el/ELUtil
at javax.el.ELManager.getExpressionFactory(ELManager.java:61) [javax.el-3.0.0.jar:3.0.0]
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:88) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.(ResourceBundleMessageInterpolator.java:47) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolator(ConfigurationImpl.java:474) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolatorConfiguredWithClassLoader(ConfigurationImpl.java:650) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at org.hibernate.validator.internal.engine.ConfigurationImpl.getMessageInterpolator(ConfigurationImpl.java:397) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.(ValidatorFactoryImpl.java:183) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:364) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final]
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:103) [validation-api-2.0.1.Final.jar:]
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:501) [hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.cfg.beanvalidation.TypeSafeActivator.activate(TypeSafeActivator.java:84) [hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_31]
at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:132) [hibernate-core-5.2.17.Final.jar:5.2.17.Final]
尝试将 hibernate 验证器从版本 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
我们正在尝试在 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-部署-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>
这是最后一个错误
Caused by: java.lang.IllegalAccessError: javax/el/ELUtil at javax.el.ELManager.getExpressionFactory(ELManager.java:61) [javax.el-3.0.0.jar:3.0.0] at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.buildExpressionFactory(ResourceBundleMessageInterpolator.java:88) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.(ResourceBundleMessageInterpolator.java:47) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolator(ConfigurationImpl.java:474) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultMessageInterpolatorConfiguredWithClassLoader(ConfigurationImpl.java:650) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at org.hibernate.validator.internal.engine.ConfigurationImpl.getMessageInterpolator(ConfigurationImpl.java:397) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.(ValidatorFactoryImpl.java:183) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:38) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:364) [hibernate-validator-6.0.12.Final.jar:6.0.12.Final] at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:103) [validation-api-2.0.1.Final.jar:] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:501) [hibernate-core-5.2.17.Final.jar:5.2.17.Final] at org.hibernate.cfg.beanvalidation.TypeSafeActivator.activate(TypeSafeActivator.java:84) [hibernate-core-5.2.17.Final.jar:5.2.17.Final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_31] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_31] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_31] at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_31] at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:132) [hibernate-core-5.2.17.Final.jar:5.2.17.Final]
尝试将 hibernate 验证器从版本 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