How can I disable javax.validation.api in JBoss 6.4

自闭症网瘾萝莉.ら 提交于 2019-11-28 01:26:52

JBoss EAP 6.x is a JEE6 implementation container. Also keep in mind that changing the bean validation modules that are shipped with JBoss EAP6 breaks the supported bits.

Bean Validation is part of JEE7 specification. You will need to upgrade to JBoss EAP7 or use WildFly 9 or 10 from the community. Both of them implement JEE7 spec which includes Bean Validation 1.1.

I have verified this answer given by Redhat support -

You can exclude the JBoss provided javax.validation api classes from the JBoss EAP 6 by excluding the jaxrs subsystem.

In addition to excluding validation classes themselves modules that depend on them should be excluded as well. Thus, the exclusion part of jboss-deployment-structure.xml should look like this:

<exclude-subsystems>
  <subsystem name="jaxrs"/>
</exclude-subsystems>
<exclusions>
  <module name="javaee.api"/>
  <module name="javax.validation.api"/>
  <module name="javax.faces.api"/>
  <module name="org.hibernate.validator"/>
</exclusions>

*note - excluding the javaee module limits the available support by RedHat

For jboss 6.2 i want to use cxf and bean validation 1.1, the previous answer didnt work for me, to make it work first i had to exclude all the dependencies then add again the javee.api excluding the imports to the javax packages like this:

<exclusions>
            <module name="javaee.api"/>
            <module name="javax.validation.api"/>
            <module name="javax.faces.api"/>
            <module name="javax.faces.api" slot="1.2"/>
            <module name="org.hibernate.validator"/>


        </exclusions>
        <dependencies>
            <module name="javaee.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/spi"/>
                        <path name="javax/validation/constraints"/>
                        <path name="javax/validation/groups"/>
                        <path name="javax/validation/metadata"/>
                    </exclude-set>
                </imports>
            </module>

        </dependencies>

Then repeat on the subdeployments of my ear.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!