我正在尝试在Wildfly 8.2.1上从https://github.com/dewthefifth/java-examples/tree/master/multi-ear-jms部署packager-01 EAR,并且收到以下错误,因为Wildfly坚持要从$ JBOSS_HOME / modules /中加载hibernate-validator模块org / hibernate / validator / main而不是我的EAR里面的那个。
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.hibernate.validator.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:223)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
注意:这是部署在同一应用服务器上的其他应用程序所需的自定义部署模块。在部署包含多个自定义hibernate模块的其他应用程序之前,我能够部署EAR。
我试图使用以下jboss-deployment-structure排除验证器模块(基本上添加了每个排除任何谷歌结果甚至暗示),但没有运气。无论我做什么,加载的验证器都是Hibernate Validator 4.2.0.Final
,而我在EAR中提供的验证器是hibernate-validator-6.0.7.Final.jar
。
<jboss-deployment-structure>
<!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
<subsystem name="resteasy" />
</exclude-subsystems>
<exclusions>
<!-- Exclude Jackson - I included my own -->
<module name="com.fasterxml.jackson.core.jackson-annotations" />
<module name="com.fasterxml.jackson.core.jackson-core" />
<module name="com.fasterxml.jackson.core.jackson-databind" />
<module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.apache.xalan" />
<module name="org.apache.xerces" />
<module name="org.jboss.logging" />
<!-- Exclude Hibernate -->
<module name="org.hibernate" />
<!-- Exclude hibernate validation -->
<module name="org.jboss.resteasy.resteasy-validator-provider-11" />
<module name="org.hibernate.validator" />
<module name="javax.validation.api" />
<module name="javaee.api" />
<module name="javax.faces.api" />
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
<dependencies>
</dependencies>
</deployment>
如果有人知道我需要排除哪个子系统,我非常感谢你的帮助。
注意:我正在共享我的Wildfly 8.2.1,甚至使用我的Wildfly 8.2.1,因为这些是我的客户部署站点对我的限制。
更新1: 感谢您的帮助。
我已达到我的新排除列表包括以下内容的程度 假
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.apache.xalan" />
<module name="org.apache.xerces" />
<module name="org.jboss.logging" />
<!-- Exclude Hibernate -->
<module name="org.hibernate" />
<module name="javax.persistence.api" />
<!-- Exclude hibernate validation -->
<module name="org.hibernate.validator" />
<module name="org.jboss.invocation" />
<module name="org.jboss.as.connector" />
<module name="org.jboss.as.ee" />
<module name="org.jboss.as.jpa" />
<module name="org.jboss.as.jpa.hibernate" />
<module name="javax.resource.api" />
<module name="org.jboss.as.ejb-client" />
<module name="org.jboss.as.weld" />
<module name="org.jboss.ironjacamar.impl" />
<module name="org.jboss.ironjacamar.jdbcadapters" />
<module name="org.jboss.resteasy.resteasy-jaxrs" />
<module name="org.jboss.resteasy.resteasy-validator-provider-11" />
<module name="javaee.api" />
<module name="javax.el.api" />
<module name="javax.enterprise.api" />
<module name="javax.faces.api" />
<module name="javax.persistence.api" />
<module name="javax.servlet.jsp.api" />
<module name="javax.validation.api" />
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
<dependencies>
</dependencies>
</deployment>
我通过为所有JBOSS打开TRACE级别登录来确定,并且基本上添加排除了第一个列出的条目,直到我停止看到Hibernate 4.0.2被加载。我还没有能够确切地说这些是真正的culperite中的哪一个,但我们正在某个地方。
我将添加WAR不再部署,现在因为它缺少核心jee库...(正如您所料)。我会在找到时间后更新,希望最终能够生成真正的(最小的)排除组合,以便它起作用。
答案 0 :(得分:1)
我认为您还需要将其从所有依赖项中排除。我正在研究6.4EAP,所以它可能会稍微改变你的jboss版本,但试试吧。所以如果你在linux上,请转到你的模块jboss子目录和grep for org.hibernate.validator
(grep -ir "org.hibernate.validator" .
)。
这将显示结果如:
./system/layers/base/org/hibernate/validator/main/module.xml:<module xmlns="urn:jboss:module:1.1" name="org.hibernate.validator">
./system/layers/base/org/jboss/as/jpa/hibernate/3/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/as/jpa/hibernate/4/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/as/jpa/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/as/ee/main/module.xml: <module name="org.hibernate.validator" optional="true"/>
./system/layers/base/org/jboss/as/connector/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/resteasy/resteasy-hibernatevalidator-provider/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/ironjacamar/impl/main/module.xml: <module name="org.hibernate.validator"/>
./system/layers/base/org/jboss/ironjacamar/jdbcadapters/main/module.xml: <module name="org.hibernate.validator"/>
然后您就可以知道需要哪些模块以及从中排除它。在这里,我发布我的配置...也许它会帮助你
<deployment>
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.slf4j"/>
<module name="org.jboss.logging"/>
<module name="org.hibernate"/>
<module name="org.hibernate.validator"/>
<module name="javaee.api"/>
<module name="javax.el.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.faces.api"/>
<module name="javax.persistence.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.validation.api"/>
</exclusions>
<dependencies>
<module name="javax.annotation.api" export="true"/>
<module name="javax.ejb.api" export="true"/>
<module name="javax.interceptor.api" export="true"/>
<module name="org.jboss.modules" export="true"/>
<module name="javax.servlet.jsp.api" export="true">
<imports>
<include path="/**"/>
<exclude-set>
<path name="javax/el"/>
</exclude-set>
</imports>
</module>
<module name="javax.enterprise.api" export="true">
<imports>
<include path="/**"/>
<exclude-set>
<path name="javax/el"/>
</exclude-set>
</imports>
</module>
</dependencies>
</deployment>
<sub-deployment name="admin.war">
<exclusions>
<module name="javaee.api"/>
<module name="javax.el.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.faces.api"/>
<module name="javax.persistence.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.validation.api"/>
<module name="org.apache.commons.logging"/>
<module name="org.apache.log4j"/>
<module name="org.jboss.logging"/>
<module name="org.hibernate"/>
<module name="org.hibernate.validator"/>
<module name="org.slf4j"/>
</exclusions>
<local-last value="true"/>
</sub-deployment>
当我删除
javax/el
时,对我有用
答案 1 :(得分:0)
我最终在另一个项目/模块上获得了成功,该项目/模块可从https://github.com/dewthefifth/spring-boot-ear-skinny-war/tree/spring-boot-2.0-with-spring-legacy-with-wfcore-209-workaround获得。
具体来说,web0项目很幸运删除了验证器,但是从EAR删除验证器的任何尝试都失败了。
github链接专注于删除,因此Spring 5+可以在JBOSS和Wildfly上使用。它包含一个自述文件,其中包含有关测试了Wildfly和JBOSS哪个版本的确切信息的详细信息,以及针对无效的JBOSS版本的解决方法(不是很好)。