You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何阻止Wildfly11自动加载Jar依赖中的@WebServiceProvider类

Solution to Prevent Wildfly 11 from Scanning @WebServiceProvider in Third-Party JAR

Since you can't modify the third-party JAR and don't want to disable the entire webservices subsystem or exclude the whole JAR, here are targeted fixes to stop Wildfly from scanning that specific GenServiceRouter class:

Option 1: Use jboss-webservices.xml (Application-Level Configuration)

Wildfly's webservices subsystem respects exclusion rules defined in a WEB-INF/jboss-webservices.xml file. Create this file with the following content to exclude the problematic class:

<jboss-webservices xmlns="http://www.jboss.com/xml/ns/javaee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-webservices_1_0.xsd">
    <webservices>
        <endpoint-config>
            <exclude-classes>
                <class>com.ca.gen80.wsrt.router.GenServiceRouter</class>
            </exclude-classes>
        </endpoint-config>
    </webservices>
</jboss-webservices>

This tells Wildfly's webservices scanner to skip this exact class, so it won't attempt to load its missing WSDL while leaving the rest of the subsystem and third-party JAR functional.

Option 2: Fine-Tune jboss-deployment-structure.xml

If Option 1 doesn't work, modify your existing jboss-deployment-structure.xml to exclude the class from the webservices subsystem's scan scope:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <!-- Remove the full webservices subsystem exclusion -->
        <subsystem xmlns="urn:jboss:domain:webservices:2.0">
            <endpoint-scan-exclude>
                <class>com.ca.gen80.wsrt.router.GenServiceRouter</class>
            </endpoint-scan-exclude>
        </subsystem>
    </deployment>
</jboss-deployment-structure>

This approach narrows down the exclusion to only the class causing issues, keeping the webservices subsystem active for other use cases.

Why Your Previous Attempts Didn't Work

  • Disabling the entire webservices subsystem: Overkill, and caused unintended errors as you noticed.
  • beans.xml with bean-discovery-mode="none": CDI's bean scan doesn't cover @WebServiceProvider annotations—those are handled by Wildfly's dedicated webservices scanner, not CDI.
  • jboss-scanning.xml: This controls general classpath scanning, but webservices has its own independent scanning mechanism that ignores these rules.

Both options above directly target the webservices subsystem's scanning logic, which is responsible for picking up @WebServiceProvider annotations.

内容的提问来源于stack exchange,提问作者trojanc

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 06:57:10