title: Spring boot app deployed as war on tomcat7 fails with error "More than one fragment with the name [org_apache_tomcat_websocket] was found"
body: <p>Deploying my spring-boot app on tomcat7 is failing, and from the error it says its caused by:</p>
  
  <pre><code>More than one fragment with the name [org_apache_tomcat_websocket] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering
  </code></pre>
  
  <p>I have tried removing duplicate dependencies but i haven't had any success</p>
  
  <p>Here is my build.gradle</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.21.RELEASE")
      }
  }
  
  apply plugin: 'java'
  apply plugin: 'eclipse'
  apply plugin: 'idea'
  apply plugin: 'org.springframework.boot'
  apply plugin: 'io.spring.dependency-management'
  apply plugin: 'war'
  apply plugin: 'application'
  
  jar {
      baseName = 'gs-interswitch-verve-mobile-service'
      version =  '0.1.0'
  }
  
  repositories {
      mavenCentral()
  }
  
  sourceCompatibility = 1.8
  targetCompatibility = 1.8
  mainClassName="verve.Application"
  
  dependencies {
      compile("org.springframework.boot:spring-boot-starter-web:1.5.21.RELEASE")
      testCompile("junit:junit")
      testCompile('org.springframework.boot:spring-boot-starter-test:1.5.21.RELEASE')
      compile("org.apache.httpcomponents:httpclient:4.0-beta1")
      compile("org.json:json:20140107")
      compile("org.bouncycastle:bcpkix-jdk15on:1.49")
      compile("com.google.code.gson:gson:2.8.5")
      compileOnly("org.springframework.boot:spring-boot-starter-tomcat:1.5.21.RELEASE")RELEASE
  }
  </code></pre>
  
  <p>I expect the app to be deployed successfully but I encounter errors which are displayed below</p>
  
  <pre><code>Jun 07, 2019 11:53:53 AM org.apache.catalina.startup.HostConfig undeploy
  INFO: Undeploying context [/InterswitchVerveMobile]
  Jun 07, 2019 11:53:53 AM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deploying web application archive /Applications/tomcat7/webapps/InterswitchVerveMobile.war
  Jun 07, 2019 11:53:53 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
  INFO: validateJarFile(/Applications/tomcat7/webapps/InterswitchVerveMobile/WEB-INF/lib/tomcat-embed-core-8.5.40.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
  Jun 07, 2019 11:53:53 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
  INFO: validateJarFile(/Applications/tomcat7/webapps/InterswitchVerveMobile/WEB-INF/lib/tomcat-embed-el-8.5.40.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
  Jun 07, 2019 11:53:53 AM org.apache.catalina.core.ContainerBase addChildInternal
  SEVERE: ContainerBase.addChild: start: 
  org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/InterswitchVerveMobile]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
      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:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [org_apache_tomcat_websocket] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering.
      at org.apache.catalina.deploy.WebXml.orderWebFragments(WebXml.java:2338)
      at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1268)
      at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5606)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      ... 10 more
  
  Jun 07, 2019 11:53:54 AM org.apache.catalina.startup.HostConfig deployWAR
  SEVERE: Error deploying web application archive /Applications/tomcat7/webapps/InterswitchVerveMobile.war
  java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/InterswitchVerveMobile]]
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1022)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020)
      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:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  
  Jun 07, 2019 11:53:54 AM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deployment of web application archive /Applications/tomcat7/webapps/InterswitchVerveMobile.war has finished in 323 ms
  </code></pre>
  
  <p>I saved the gradle dependencies in a file using <code>./gradlew dependencies &gt; deps.txt</code>, the contents can be found in a github gist <a href="https://gist.github.com/Phainix/31aa9b95232e6394c95f97fabdc94c79" rel="nofollow noreferrer">https://gist.github.com/Phainix/31aa9b95232e6394c95f97fabdc94c79</a></p>
  
  <p>I would appreciate any help</p>