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

部署.ear包时遇ArrayIndexOutOfBoundsException,求WebLogic解决方案

解决WebLogic部署时BEA-101371注解处理错误(ArrayIndexOutOfBoundsException)

这个错误是WebLogic注解处理器在处理@WebServiceRef注解时触发的数组下标越界问题,属于WebLogic的已知兼容性BUG,以下是几种可行的解决方案:

  • 修复@WebServiceRef注解的错误用法
    排查项目中所有使用@WebServiceRef的代码,确保注解配置完整,避免空注解或缺失必要属性的情况:

    • 错误示例:
      @WebServiceRef() // 无属性配置会触发处理器异常
      private UserWebService userService;
      
    • 正确示例:
      // 指定服务类型
      @WebServiceRef(type = UserWebService.class)
      private UserWebService userService;
      
      // 或指定JNDI lookup名称
      @WebServiceRef(lookup = "java:comp/env/services/UserWebService")
      private UserWebService userService;
      
  • 临时禁用WebLogic注解自动处理
    如果无法立即修改代码,可通过配置文件关闭WebLogic的注解扫描功能(注意:此方案会禁用所有注解处理,可能影响其他依赖注解的功能,仅作应急使用):
    在WAR包的WEB-INF/weblogic.xml中添加如下配置:

    <weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app">
        <wls:container-descriptor>
            <wls:annotation-processing-disabled>true</wls:annotation-processing-disabled>
            <wls:prefer-application-packages>
                <wls:package-name>javax.jws.*</wls:package-name>
                <wls:package-name>javax.xml.ws.*</wls:package-name>
            </wls:prefer-application-packages>
        </wls:container-descriptor>
    </weblogic-web-app>
    
  • 安装WebLogic官方补丁
    Oracle针对该BUG发布了多个版本的补丁,根据你使用的WebLogic版本(如12.1.3、12.2.1.x、14c),安装对应补丁(关联BUG号:19023421、20872127等)后可彻底修复注解处理器的数组越界问题。

  • 调整打包依赖,避免类加载冲突
    检查项目打包后的WAR/EAR包,确保未包含WebLogic自带的javax.xml.ws相关API类,防止类加载冲突:

    • 若使用Maven,将JAX-WS相关依赖标记为provided,让WebLogic使用自身库:
      <dependency>
          <groupId>javax.xml.ws</groupId>
          <artifactId>jaxws-api</artifactId>
          <version>2.3.1</version>
          <scope>provided</scope>
      </dependency>
      

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.06 00:20:30