質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Struts

StrutsはJava向けのWebアプリケーションフレームです。MVCモデルに基づいており、JSPやJavaサーブレットを組み合わせ、アプリケーション構築時に使用する各機能を提供しています。

Tomcat

TomcatはApache Software Foundation (ASF)で開発されたオープンソースのWebコンテナです。

Q&A

解決済

1回答

4653閲覧

Java/Struts2の入門者用サンプルが404になってしまう。

yrema

総合スコア286

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Struts

StrutsはJava向けのWebアプリケーションフレームです。MVCモデルに基づいており、JSPやJavaサーブレットを組み合わせ、アプリケーション構築時に使用する各機能を提供しています。

Tomcat

TomcatはApache Software Foundation (ASF)で開発されたオープンソースのWebコンテナです。

0グッド

0クリップ

投稿2017/05/18 08:26

###前提・実現したいこと
ここに質問したいことを詳細に書いてください
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

<?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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>struts2</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list>
<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>
</web-app>

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

<html> <body> <s:form> こんにちは。 <s:submit method="hello" value="こちらこそこんにちは"/> </s:form> </body> </html>

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

<html> <body> <s:property value=”%{message}”/> </body> </html>

###試したこと
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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

ahodana

2017/05/18 23:41

重大: 以前のエラーのためにコンテキストの起動が失敗しました [/parking] [木 5 18 17:01:05 JST 2017]
guest

回答1

0

自己解決

自己解決に至りました。

投稿2017/05/19 00:05

yrema

総合スコア286

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問