2016-07-24 62 views
0

我正在使用maven,eclipse。從eclipse運行時一切都很好。 但相同的,如果我部署在Tomcat它返回HTTP狀態404 日誌上說classpath中沒有檢測到春天WebApplicationInitializer的類型,但我使用的web.xml在eclipse中工作的Spring應用程序,但在tomcat上部署時也同樣不工作8

我不能夠在這裏找出問題,如果有人可以幫助請。 過濾器和servlet映射沒有問題。

的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 真

<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> 

服務器日誌:

24-JUL-2016 13:20:57.816 INFO [本地主機 - startStop-1] org.apache.catalina .core.ApplicationContext.log No Spring 在類路徑上檢測到的WebApplicationInitializer類型24-Jul-2016 13:20:58.331信息[localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log初始化Spring root WebApplicationContext 24-Jul-2016 13:21:25.913信息 [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log初始化Spring FrameworkServlet的 'sportingEasy' 24-JUL-2016 13:21:42.699 INFO [本地主機 - startStop-1] 類路徑上24-JUL-2016 檢測org.apache.catalina.core.ApplicationContext.log無彈簧 WebApplicationInitializer類型13:22:02.971 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log否Spring 在類路徑上檢測到WebApplicationInitializer類型2016年7月24日 13:22:03.034信息[localhost-sta rtStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()24-Jul-2016 13:22:03.034信息 [localhost-startStop-1] org.apache.catalina.core。 ApplicationContext.log SessionListener: contextInitialized()24-JUL-2016 13:22:48.611 INFO [本地主機 - startStop-1]上的類路徑

檢測 org.apache.catalina.core.ApplicationContext.log無彈簧 WebApplicationInitializer類型
+0

您是否使用彈簧引導? –

+0

不要使用彈簧引導。 – Rajj

+0

是的我試過乾淨的安裝,構建,過程類.. – Rajj

回答

1

我也有同樣的問題。我的maven有tomcat7插件,但JRE環境爲1.6。我將tomcat7更改爲tomcat6,錯誤消失了。您可以檢查一次您的JRE環境並嘗試。 也請在您的pom.xml中添加'maven-war-plugin'版本2.6

+0

你的意思是說它在eclipse中工作,但不是在獨立的tomcat中工作?在這些步驟之後,它開始在獨立的tomcat中工作。 – Rajj

+0

問題與tomcat verison有關 – Panky031

相關問題