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:
Error 404: SRVE0190E: File not found: {0}
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.
SRVE0292I: Servlet Message - [app#app.war]:.No Spring WebApplicationInitializer types detected on classpath
My application is configured using Java Config files instead of the traditional XML and I'm half guessing this is part of the problem?
I found a blog post saying that there were some server settings that needed to be applied. I've tried those with no success:
com.ibm.ws.webcontainer.mapFiltersToAsterisk=true
com.ibm.ws.webcontainer.removetrailingservletpathslash=true
com.ibm.ws.webcontainer.invokeFiltersCompatibility=true
I'm at a loss, does anyone have any ideas?
Due to some followup, I'll post my web.xml and WebappInitializer:
@Order(2)
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected String[] getServletMappings() {
return new String[]{"/"};
}
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[] {ApplicationConfig.class, DataSourceConfig.class, JpaConfig.class, SecurityConfig.class, MailConfig.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] {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");
}
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- Map all errors to Spring MVC handler method. See CustomErrorController.generalError() -->
<error-page>
<location>/generalError</location>
</error-page>
<session-config>
<session-timeout>15</session-timeout>
</session-config>
<display-name>eua</display-name>
</web-app>
ServletContextInitializerstuff. In theory it should just work. How are you creating your war/jar file? Is theWebAppInitializerin WEB-INF/classes or inside a jar in WEB-INF/lib? - M. Deinum