0

Eclipse IDE を使用して開発された単純な春の Web アプリ プロジェクトがあります。jetty サーバーを使用してプロジェクトを実行すると、サーバーが起動します。次に、詳細を使用してコンテキストに移動しようとすると、次のエラー 404 が表示されます。

ここに画像の説明を入力

これは、開始画面を定義した web.xml ファイルです。

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>TouchPOS</display-name>
  <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>layout.html</welcome-file>
  </welcome-file-list>
</web-app>

これがプロジェクトのリソースです。

ここに画像の説明を入力

ここで何が間違っていますか?サーバーの起動中に例外はありません。私を助けてください!

コンソールを表示すると、次のエラーが表示されました。どうすれば解決できますか。

    WARNING: No mapping found for HTTP request with URI [/TouchPOSApplication/layout.html] in DispatcherServlet with name 'dispatcher'
Apr 19, 2013 10:53:48 AM org.springframework.web.servlet.PageNotFound noHandlerFound

mvc-config ファイル

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
</beans>    
4

1 に答える 1

0

アプリケーションが、実行する予定の webapp コンテキスト パスで実行されていることを確認してください。war ファイルの名前は何ですか? また、コンテキスト パスを構成する webapp に jetty context.xml ファイルを提供しましたか?

そうでない場合は、war ファイルの名前をコンテキスト パスとして使用してみてください。

例えば:

戦争の名前が「webapps/touchpos.war」の場合は、試してください"http://localhost:8080/touchpos/"

于 2013-04-19T08:37:32.780 に答える