【问题标题】:Cryptic jetty-maven-plugin error message 'ERROR: PWC6117: File "null" not found'神秘的 jetty-maven-plugin 错误消息'错误:PWC6117:找不到文件“null”'
【发布时间】:2011-09-30 07:10:21
【问题描述】:

我有一个生成 WAR 文件的 Maven Webapp。 我刚刚将我的 Jetty 插件升级到 7.4.2.v20110526(来自 6.x)。我有以下设置:

        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>7.4.2.v20110526</version>

            <executions>
                <execution>
                    <id>jetty-run</id>

                    <phase>package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>

                    <configuration>
                        <connectors>
                            <connector implementation="${connector}">
                                <port>80</port>
                                <maxIdleTime>60000</maxIdleTime>
                            </connector>
                        </connectors>

                        <webAppConfig>
                            <contextPath>/foo</contextPath>
                        </webAppConfig>

                        <webappDirectory>${project.build.directory}/foo</webappDirectory>

                        <scanIntervalSeconds>10</scanIntervalSeconds>

                        <systemProperties>
                            <systemProperty>
                                <name>logback.configurationFile</name>
                                <value>file:${basedir}/target/${project.artifactId}-${project.version}/WEB-INF/classes/logback.xml</value>
                            </systemProperty>
                        </systemProperties>
                    </configuration>
                </execution>
            </executions>

            <dependencies>
                <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.13</version>
                </dependency>
            </dependencies>
        </plugin>

由于一些我不清楚的原因,我不断收到下面的神秘错误消息:

2011-07-07 11:51:16.431:WARN::Aliased resource: file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp~=file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp
2011-07-07 11:51:16.507:WARN::Aliased resource: file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp~=file:/java/foo/branches/stable/modules/foo-web/src/main/webapp/WEB-INF/jsps/main.jsp
ERROR: PWC6117: File "null" not found

也不例外,但是我无法登录webapp。

但是,如果我获取生成的 war 文件并将其部署到干净的 Jetty 安装中,它会完美运行。这是怎么回事……?我的意思是,这曾经与 6.x 插件一起使用。没有任何代码更改。

展开后的目录内容与war文件中的内容完全一样——我检查了——没有丢失文件或任何明显的差异。

这是一个 Spring Web 项目。

有什么想法吗?有人见过这个吗?

非常感谢!

【问题讨论】:

    标签: maven-2 jetty maven-jetty-plugin


    【解决方案1】:

    确保您的 ModelAndView-s 在您的控制器中正确映射:

    return new ModelAndView("WEB-INF/jsps/main");
    

    【讨论】:

    • 那应该在你的控制器里。
    【解决方案2】:

    就我而言,@tftd 提供的上述解决方案不起作用,所以我注释掉了 defaultHandler 属性,然后错误日志消失了。

    <bean id="classNameControllerMappings"
          class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
        <property name="caseSensitive" value="true" />
        <property name="order" value="2" />
        <!--property name="defaultHandler">
            <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
        </property-->
    </bean>
    

    【讨论】:

      【解决方案3】:

      确保您已导入 org.springframework.web.servlet.ModelAndView。一旦我通过导入 org.springframework.web.portlet.ModelAndView 遇到了这个问题。

      【讨论】:

        猜你喜欢
        • 2012-07-08
        • 1970-01-01
        • 2014-11-09
        • 1970-01-01
        • 1970-01-01
        • 2013-01-02
        • 2013-11-08
        • 1970-01-01
        • 2013-03-29
        相关资源
        最近更新 更多