1

我有一个问题让我抓狂:

我有一个 maven 项目,(在 maven 项目中使用插件的play2应用程序)play2war

当我启动 mvntomcat7:run-wartomcat:run-war(我更改 servlet 容器)时,这是 rsult :

    [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,给我一个404and 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....

4

2 回答 2

1

对于日志添加插件配置这部分

               <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>
于 2013-12-09T17:10:06.423 回答
0

使用<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>
于 2013-12-03T12:37:56.247 回答