###前提・実現したいこと
ここに質問したいことを詳細に書いてください
Java/Struts2の入門者用サンプルが404になってしまう。
以下の「@いう間にWebアプリを作れる「Struts 2」入門」の通りに作成。
http://www.atmarkit.co.jp/fjava/special/struts2/struts2_2.html
>「http://localhost:8080/sample/index.action」にアクセスします。以下のような画面が出れば、成功です(拡張子が.actionであることに注意しましょう)。
とあるが、そのURLにアクセスしても404画面が出てしまいます。
エラー詳細のログが出力されないため、何が原因なのかわからない状況です。(catalina.outが出力されるはずだが、出力されていない)
###発生している問題・エラーメッセージ
情報: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\pleiades\java\7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/pleiades/eclipse/jre/bin/server;C:/pleiades/eclipse/jre/bin;C:/pleiades/eclipse/jre/lib/amd64;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseSVN\bin;C:\Program Files\WinMerge;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\Users\mediapro\Anaconda3;C:\Users\mediapro\Anaconda3\Scripts;C:\Users\mediapro\Anaconda3\Library\bin;C:\Users\mediapro\AppData\Local\Programs\Python\Python36-32\Scripts;C:\Users\mediapro\AppData\Local\Programs\Python\Python36-32;C:\Users\mediapro\AppData\Local\Microsoft\WindowsApps;;C:\pleiades\eclipse;;. [木 5 18 17:00:58 JST 2017]
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:parking' did not find a matching property. [木 5 18 17:00:59 JST 2017]
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:struts2' did not find a matching property. [木 5 18 17:00:59 JST 2017]
情報: Initializing ProtocolHandler ["http-bio-8080"] [木 5 18 17:00:59 JST 2017]
情報: Initializing ProtocolHandler ["ajp-bio-8009"] [木 5 18 17:00:59 JST 2017]
情報: Initialization processed in 396 ms [木 5 18 17:00:59 JST 2017]
情報: サービス Catalina を起動します [木 5 18 17:00:59 JST 2017]
情報: Starting Servlet Engine: Apache Tomcat/7.0.52 [木 5 18 17:00:59 JST 2017]
情報: No Spring WebApplicationInitializer types detected on classpath [木 5 18 17:01:01 JST 2017]
重大: フィルタ struts2 の起動中の例外です [木 5 18 17:01:01 JST 2017]
重大: Error filterStart [木 5 18 17:01:01 JST 2017]
重大: 以前のエラーのためにコンテキストの起動が失敗しました [/struts2] [木 5 18 17:01:01 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/core is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined [木 5 18 17:01:03 JST 2017]
情報: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined [木 5 18 17:01:03 JST 2017]
情報: No Spring WebApplicationInitializer types detected on classpath [木 5 18 17:01:03 JST 2017]
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.
情報: Initializing Spring root WebApplicationContext [木 5 18 17:01:03 JST 2017]
重大: クラス org.springframework.web.context.ContextLoaderListener のリスナインスタンスにコンテキスト初期化イベントを送信中の例外です [木 5 18 17:01:05 JST 2017]
重大: Error listenerStart [木 5 18 17:01:05 JST 2017]
重大: 以前のエラーのためにコンテキストの起動が失敗しました [/parking] [木 5 18 17:01:05 JST 2017]
情報: Closing Spring root WebApplicationContext [木 5 18 17:01:05 JST 2017]
重大: The web application [/parking] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. [木 5 18 17:01:05 JST 2017]
重大: The web application [/parking] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. [木 5 18 17:01:05 JST 2017]
情報: Starting ProtocolHandler ["http-bio-8080"] [木 5 18 17:01:05 JST 2017]
情報: Starting ProtocolHandler ["ajp-bio-8009"] [木 5 18 17:01:05 JST 2017]
情報: Server startup in 5937 ms [木 5 18 17:01:05 JST 2017]
###該当のソースコード
C:\pleiades\workspace\struts2\WebContent\WEB-INF\web.xml
</web-app><filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher </filter-class> <init-param> <param-name>actionPackages</param-name> <param-value>test</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
C:\pleiades\workspace\struts2\WebContent\WEB-INF\index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
C:\pleiades\workspace\struts2\src\IndexAction\IndexAction.java
package IndexAction;
import com.opensymphony.xwork2.ActionSupport;
public class IndexAction extends ActionSupport {
public String execute() throws Exception { return "success"; } public String message; public String hello() throws Exception { message = "いえいえこちらこそこんにちは。"; return "hello"; }
}
C:\pleiades\workspace\struts2\WebContent\index-hello.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
###試したこと
http://localhost:8080/struts2/index.action にアクセスしたが404。
http://localhost:8080/struts2/Index.action にアクセスしたが404。
C:\pleiades\tomcat\7\conf\logging.properties のログレベル「FINE」となっている箇所を全て「ALL」にしたが、catalina.outが出力されないのでエラー原因が分からない。
###補足情報(言語/FW/ツール等のバージョンなど)
バージョン情報
Windwos 10
Struts 2.5.10.1
Eclipse 3.1
Tomcat 7.0
回答1件
あなたの回答
tips
プレビュー