title: Cannot deploy Spring App to Websphere
body: <p>I've been developing an application to tomcat during development phase.  As we're moving forward, my client wants to be deployed to websphere.  I'm attempting to do so on websphere 8.5, but for some reason I seem to be running into problems.  Tomcat is easy, I'm just dropping in the war and everything works like it should.  Websphere is a different story.  I keep getting the following error when I try to hit my application:</p>
  
  <pre><code>Error 404: SRVE0190E: File not found: {0}
  </code></pre>
  
  <p>I've been doing some research and aside from the one line below, I don't notice anything strange in the logs.  The admin console says the application is running with no problems.</p>
  
  <pre><code>SRVE0292I: Servlet Message - [app#app.war]:.No Spring WebApplicationInitializer types detected on classpath
  </code></pre>
  
  <p>My application is configured using Java Config files instead of the traditional XML and I'm half guessing this is part of the problem?</p>
  
  <p>I found a blog post saying that there were some server settings that needed to be applied.  I've tried those with no success:</p>
  
  <pre><code>com.ibm.ws.webcontainer.mapFiltersToAsterisk=true
  com.ibm.ws.webcontainer.removetrailingservletpathslash=true
  com.ibm.ws.webcontainer.invokeFiltersCompatibility=true
  </code></pre>
  
  <p>I'm at a loss, does anyone have any ideas?</p>
  
  <p>Due to some followup, I'll post my web.xml and WebappInitializer:</p>
  
  <pre><code>@Order(2)
  public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  
      @Override
      protected String[] getServletMappings() {
          return new String[]{"/"};
      }
  
      @Override
      protected Class&lt;?&gt;[] getRootConfigClasses() {
          return new Class&lt;?&gt;[] {ApplicationConfig.class, DataSourceConfig.class, JpaConfig.class, SecurityConfig.class, MailConfig.class};
      }
  
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          return new Class&lt;?&gt;[] {WebMvcConfig.class};
      }
  
      @Override
      protected Filter[] getServletFilters() {
          CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
          characterEncodingFilter.setEncoding("UTF-8");
          characterEncodingFilter.setForceEncoding(true);
          return new Filter[] {characterEncodingFilter};
      }
  
      @Override
      protected void customizeRegistration(ServletRegistration.Dynamic registration) {
          registration.setInitParameter("defaultHtmlEscape", "true");
          registration.setInitParameter("spring.profiles.active", "default");
      }
  }
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
          version="3.0" metadata-complete="false"&gt;
          &lt;!-- Map all errors to Spring MVC handler method. See CustomErrorController.generalError() --&gt;
          &lt;error-page&gt;
              &lt;location&gt;/generalError&lt;/location&gt;
          &lt;/error-page&gt;
          &lt;session-config&gt;
            &lt;session-timeout&gt;15&lt;/session-timeout&gt;
         &lt;/session-config&gt;
         &lt;display-name&gt;eua&lt;/display-name&gt;
      &lt;/web-app&gt;
  </code></pre>