Cryptic jetty-maven-plugin error message 'ERRO

2019-02-18 05:34发布

问题:

I have a Maven Webapp producing a WAR file. I've just upgraded my Jetty plugin to the 7.4.2.v20110526 (from 6.x). I have the following set up:

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

For some unclear to me reason, I keep getting the cryptic error message below:

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

There is no exception, however I cannot log in to the webapp.

However, if I grab the produced war file and deploy it into a clean Jetty installation, it works perfectly. What's the deal here...? I mean, this used to work with the 6.x plugin. No code changes whatsoever.

The contents of the exploded directory are exactly the same as the ones in the war file - I checked -- there are no missing files or any obvious differences.

This is a Spring Web project.

Any ideas? Has anybody seen this before?

Many thanks in advance!

回答1:

Make sure your ModelAndView-s are mapped properly in your controller:

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


回答2:

In my case, above solution @tftd provided did not work so I commented out defaultHandler property, then error log disappeared.

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

Make sure you have imported org.springframework.web.servlet.ModelAndView. Once i had got this problem by importing org.springframework.web.portlet.ModelAndView.