Skip to content

spring boot with dubbo 2.6.3, cause ‘ Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml’ #2535

@iorilchen

Description

@iorilchen

Environment

  • Dubbo version: 2.6.3
  • Operating System version: Linux ubuntu 4.9.0
  • Java version: 1.8
  • tomcat-7.0.82.4
  • spring boot 2.0.1.RELEASE

Steps to reproduce this issue

a web spring boot project use dubbo as a consumer,when deploy it to tomcat-7.0.82.4 ,start the applicaton failed, but it start success in IDE without tomcat

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

web project start success

Actual Result

failed

If there is an exception, please attach the exception trace:

[ERROR] - Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:262)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5110)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1015)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:991)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2038)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions