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

Struts 1.3迁移至2.5.29时在JBoss 4.0.5.GA上遇Tiles部署失败

Struts 1.3迁移至Struts 2.5.29部署JBoss 4.0.5.GA失败排查

问题描述

我正将基于Struts 1.3的应用迁移至Struts 2.5.29,部署环境为JBoss-4.0.5.GA。参考Struts 2 Tiles插件示例后,部署失败,仅输出以下异常信息:

[main] WARN org.jboss.system.ServiceController - Problem starting service jboss.web.deployment:war=abc.war,id=-974944616
    deployment failed
            at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:375)
            at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
            at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
            at org.jboss.web.WebModule.startModule(WebModule.java:83)
            at org.jboss.web.WebModule.startService(WebModule.java:61)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
            at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
            at com.sun.proxy.$Proxy0.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:417)
            at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)



--- MBeans waiting for other MBeans ---
ObjectName: jboss.web.deployment:war=abc.war,id=-974944616
  State: FAILED
  Reason: org.jboss.deployment.DeploymentException: URL file:...../abc.war/ deployment failed

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.web.deployment:war=abc.war,id=-974944616
  State: FAILED
  Reason: org.jboss.deployment.DeploymentException: URL file:........... deployment failed

排查步骤

  • 版本兼容性修复
    JBoss 4.0.5.GA仅支持Servlet 2.4,而Struts 2.5.29要求Servlet 3.0+,这是核心冲突:

    • 要么降级Struts 2到兼容Servlet 2.4的版本(如Struts 2.3.x系列)
    • 要么在依赖管理工具中排除Struts依赖里的servlet-api、jsp-api包,避免和JBoss自带的旧版本API冲突
  • 清理Struts 1残留配置
    彻底移除Struts 1相关的所有文件和依赖:

    • 删除web.xml中的Struts 1 ActionServlet配置,替换为Struts 2的org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
    • 删除旧的struts-config.xml、tiles-defs.xml等Struts 1配置文件,改用Struts 2的struts.xml和tiles.xml规范
    • 移除项目中struts-core.jar、struts-tiles.jar等Struts 1依赖包
  • 配置JBoss类加载隔离
    在WEB-INF下创建jboss-web.xml,强制应用优先加载自身依赖,避免容器类冲突:

    <jboss-web>
      <class-loading java2ClassLoadingCompliance="false">
        <loader-repository>
          com.yourcompany:archive=abc.war
          <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
        </loader-repository>
      </class-loading>
    </jboss-web>
    
  • 开启详细日志定位根因
    当前日志信息不足,需开启JBoss DEBUG日志:

    • 修改JBOSS_HOME/server/default/conf/log4j.xml,将org.jboss.web和org.apache.struts2的日志级别改为DEBUG
    • 重新部署,查看完整错误栈,定位具体的类加载异常或配置错误

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 11:30:51