簡體   English   中英

mvn tomcat7:run-war或tomcat:run-war給出404並且沒有日志

[英]mvn tomcat7:run-war or tomcat:run-war give a 404 and no logs

我有一個讓我發瘋的問題:

我有一個Maven項目,(Maven項目中的play2應用程序帶有play2war插件)

當我啟動mvn tomcat7:run-wartomcat:run-war (我更改servlet容器)時,這是結果:

    [INFO] Running war on http://localhost:8090/arhswfe
    [INFO] Creating Tomcat server configuration atC:\dev\projects\publicwebsite\sources\arhsweb\frontend\target\tomcat
    [INFO] create webapp with contextPath: /arhswfe
    Nov 08, 2013 4:30:55 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8090"]
    Nov 08, 2013 4:30:55 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Tomcat
    Nov 08, 2013 4:30:55 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.37
    Nov 08, 2013 4:30:55 PM org.apache.tomcat.util.digester.Digester endElement
    WARNING:   No rules found matching 'Context/Logger'.
   Nov 08, 2013 4:30:56 PM org.apache.coyote.AbstractProtocol start
   INFO: Starting ProtocolHandler ["http-bio-8090"]

一切似乎都可以,但是當我在url測試時,給我一個404並且no logs ,在獨立服務器上也可以。

你有什么主意嗎 我已經配置了所有可能的方法:

    <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.1</version>
        <configuration>
            <tomcatLoggingFile>D:/log.txt</tomcatLoggingFile>
            <warDirectory>${project.build.directory}</warDirectory>
            <update>true</update>
            <contextReloadable>true</contextReloadable>
            <port>8090</port>
            <warFile>arhswfe.war</warFile>
            <ignorePackaging>true</ignorePackaging>
            <contextFile>../configuration/context.xml</contextFile>
        </configuration>
     </plugin>

日志總是空的,沒有錯誤,但是是`404....

對於日志記錄,請在插件配置中添加此部分

               <extraDependencies>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                        <version>1.7.2</version>
                    </dependency>
                    <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>jul-to-slf4j</artifactId>
                        <version>1.7.2</version>
                    </dependency>
                    <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.17</version>
                    </dependency>
                </extraDependencies>

使用<path>/</path>標記,這樣您的配置將變為:

       <configuration>
            <tomcatLoggingFile>D:/log.txt</tomcatLoggingFile>
            <warDirectory>${project.build.directory}</warDirectory>
            <update>true</update>
            <contextReloadable>true</contextReloadable>
            <port>8090</port>
            **<path>/</path>**
            <warFile>arhswfe.war</warFile>
            <ignorePackaging>true</ignorePackaging>
            <contextFile>../configuration/context.xml</contextFile>
        </configuration>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM