0
votes

I am using maven, eclipse. Everything is fine when running from eclipse. But same if I deploy on tomcat it returns http status 404. log says No Spring WebApplicationInitializer types detected on classpath but I am using web.xml

I am not able to figure out issue here, if anybody can help please. There is no issue with filter and servlet mapping.

web.xml

contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext

<!-- Location of Java @Configuration classes that configure the components 
    that makeup this application -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>com.asuare.temapp</param-value>
</context-param>

<context-param>
    <param-name>org.atmosphere.cpr.sessionSupport</param-name>
    <param-value>true</param-value>
</context-param>

<!-- Specifies the default mode of this application, to be activated if 
    no other profile (or mode) is specified -->
<context-param>
    <param-name>spring.profiles.default</param-name>
    <param-value>mysql</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Secures the application -->

securityFilter org.springframework.web.filter.DelegatingFilterProxy targetBeanName springSecurityFilterChain true

<filter-mapping>
    <filter-name>securityFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <async-supported>true</async-supported>
</filter-mapping>

<!-- Handles requests into the application -->
<servlet>

    <servlet-name>temapp</servlet-name>
    <servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
    <async-supported>true</async-supported>
    <init-param>
        <param-name>org.atmosphere.servlet</param-name>
        <param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
    </init-param>
    <!-- No explicit configuration file reference here: everything is configured 
            in the root container for simplicity -->
    <init-param>
        <param-name>contextClass</param-name>
        <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext
        </param-value>
    </init-param>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value></param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>
    <servlet-name>temapp</servlet-name>
    <url-pattern>/</url-pattern>
    <async-supported>true</async-supported>
</servlet-mapping>

<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>
        com.opensymphony.module.sitemesh.filter.PageFilter
    </filter-class>
    <async-supported>true</async-supported>
</filter>

<filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <async-supported>true</async-supported>    
</filter-mapping>

<error-page>
    <error-code>403</error-code>
    <location>/denied</location>
</error-page>

<error-page>
    <error-code>401</error-code>
    <location>/restapi/denied</location>
</error-page>

server log:

24-Jul-2016 13:20:57.816 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath 24-Jul-2016 13:20:58.331 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext 24-Jul-2016 13:21:25.913 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'sportingEasy' 24-Jul-2016 13:21:42.699 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath 24-Jul-2016 13:22:02.971 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath 24-Jul-2016 13:22:03.034 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized() 24-Jul-2016 13:22:03.034 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized() 24-Jul-2016 13:22:48.611 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath

1
Are you using spring-boot?Karthikeyan Vaithilingam
no not using spring-boot.Rajj
Yes I tried clean install, build, process-classes..Rajj
can you post your web.xml and your pom.xml ?AchillesVan
your <url-pattern>/</url-pattern> is not firing the Dispatcherservlet because -temapp- is pointing to some other class. Not 100% sur but you should consider this aspect.AchillesVan

1 Answers

1
votes

I also had the same problem. My maven had tomcat7 plugin but the JRE environment was 1.6. I changed my tomcat7 to tomcat6 and the error was gone.Could you check once your JRE environment and try. Also please add the 'maven-war-plugin' version 2.6 in your pom.xml