Eclipse で簡単な Maven アプリケーションを作成しようとしています。私は春を使用しています。tomcat server.xml の次の行に次の行を追加しました
<Context docBase="E:\Java\eclipse\Workspace\j2eeexample\target\j2eeexample-0.0.1-SNAPSHOT.war" path="/test" reloadable="true"/>
docBase のパスは正しいです。また、Maven srs/main/webapp に次の jsp ファイルがあります。
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<h1> Hi kousha</h1>
</body>
</html>
プログラムをMavenインストールとして実行すると、次の警告のみが表示されます。
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
その後:
[INFO] BUILD SUCCESS
しかし、サーバーを実行して URL (localhost:8020/test) を入力すると、HTTP ステータス 404 エラーが発生します。
私が何かを逃した場合、何か考えはありますか?
ちなみに、「mvn --version」コマンドを試してみたところ、うまくいきました(mavenのインストールに問題はないと思います)。
Mavenインストールモードでプログラムを実行したときのコンソール全体は次のとおりです。
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Marven_test 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ j2eeexample ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ j2eeexample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ j2eeexample ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ j2eeexample ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ j2eeexample ---
[INFO] Surefire report directory: E:\Java\eclipse\Workspace\j2eeexample\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ j2eeexample ---
[INFO] Packaging webapp
[INFO] Assembling webapp [j2eeexample] in [E:\Java\eclipse\Workspace\j2eeexample\target\j2eeexample-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [E:\Java\eclipse\Workspace\j2eeexample\src\main\webapp]
[INFO] Webapp assembled in [15 msecs]
[INFO] Building war: E:\Java\eclipse\Workspace\j2eeexample\target\j2eeexample-0.0.1-SNAPSHOT.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ j2eeexample ---
[INFO] Installing E:\Java\eclipse\Workspace\j2eeexample\target\j2eeexample-0.0.1-SNAPSHOT.war to C:\Users\kousha\.m2\repository\Mave\j2eeexample\0.0.1-SNAPSHOT\j2eeexample-0.0.1-SNAPSHOT.war
[INFO] Installing E:\Java\eclipse\Workspace\j2eeexample\pom.xml to C:\Users\kousha\.m2\repository\Mave\j2eeexample\0.0.1-SNAPSHOT\j2eeexample-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.157s
[INFO] Finished at: Thu Mar 07 14:42:36 PST 2013
[INFO] Final Memory: 9M/243M
[INFO] ------------------------------------------------------------------------