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

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

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

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Java EE

Java EE(Java Enterprise Edition)はJavaベースのテクノロジーとその相互運用の仕様をまとめたものです。サーバとクライアントのアーキテクチャを規定し、特定アプリケーションのクラス用に定義されたテクノロジー設定のプロファイルを使用します。

Eclipse

Eclipseは、IBM社で開発された統合開発環境のひとつです。2001年11月にオープンソース化されました。 たくさんのプラグインがあり自由に機能を追加をすることができるため、開発ツールにおける共通プラットフォームとして位置づけられています。 Eclipse自体は、Javaで実装されています。

Tomcat

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

Q&A

0回答

371閲覧

tomcatにデプロイしたい

tanisi6

総合スコア3

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Java EE

Java EE(Java Enterprise Edition)はJavaベースのテクノロジーとその相互運用の仕様をまとめたものです。サーバとクライアントのアーキテクチャを規定し、特定アプリケーションのクラス用に定義されたテクノロジー設定のプロファイルを使用します。

Eclipse

Eclipseは、IBM社で開発された統合開発環境のひとつです。2001年11月にオープンソース化されました。 たくさんのプラグインがあり自由に機能を追加をすることができるため、開発ツールにおける共通プラットフォームとして位置づけられています。 Eclipse自体は、Javaで実装されています。

Tomcat

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

0グッド

0クリップ

投稿2022/09/04 09:24

tomcatにeclipseでつくったwebアプリをデプロイしたいです。フォワードして白紙のページを表示するだけのプロジェクトのwarファイルを作成し、tomucatのアプリケーションマネージャーに配備しましたがアプリを開くと404エラーになります。

herokuでもデプロイしましたが、同じく404でした。

実現したいこと

とにかくデプロイしたい。

該当のソースコード

ファイル構成

servlet

1 2package servlet; 3 4import java.io.IOException; 5 6import javax.servlet.RequestDispatcher; 7import javax.servlet.ServletException; 8import javax.servlet.annotation.WebServlet; 9import javax.servlet.http.HttpServlet; 10import javax.servlet.http.HttpServletRequest; 11import javax.servlet.http.HttpServletResponse; 12 13/** 14 * Servlet implementation class Servlet 15 */ 16@WebServlet("/Servlet") 17public class Servlet extends HttpServlet { 18 private static final long serialVersionUID = 1L; 19 20 /** 21 * @see HttpServlet#HttpServlet() 22 */ 23 public Servlet() { 24 super(); 25 // TODO Auto-generated constructor stub 26 } 27 28 /** 29 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 */ 31 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 // TODO Auto-generated method stub 33 response.getWriter().append("Served at: ").append(request.getContextPath()); 34 35 RequestDispatcher dispatcher=request.getRequestDispatcher("/c/index.jsp"); 36 dispatcher.forward(request, response); 37 } 38 39 /** 40 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 41 */ 42 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 43 // TODO Auto-generated method stub 44 doGet(request, response); 45 } 46 47} 48

index.jsp

1 2<%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4<!DOCTYPE html> 5<html> 6<head> 7<meta charset="UTF-8"> 8<title>Insert title here</title> 9</head> 10<body> 11 12</body> 13</html>

tomcatのserver.xml

1 2 3<?xml version="1.0" encoding="UTF-8"?> 4 5<!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements. See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. --> 6 7<!-- Note: A "Server" is not itself a "Container", so you may notdefine subcomponents such as "Valves" at this level.Documentation at /docs/config/server.html --> 8 9-<Server shutdown="SHUTDOWN" port="8005"> 10 11<Listener className="org.apache.catalina.startup.VersionLoggerListener"/> 12 13<!-- Security listener. Documentation at /docs/config/listeners.html<Listener className="org.apache.catalina.security.SecurityListener" /> --> 14 15 16<!-- APR library loader. Documentation at /docs/apr.html --> 17 18 19<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/> 20 21<!-- Prevent memory leaks due to use of particular java/javax APIs--> 22 23 24<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> 25 26<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> 27 28<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/> 29 30<!-- Global JNDI resourcesDocumentation at /docs/jndi-resources-howto.html --> 31 32 33 34-<GlobalNamingResources> 35 36<!-- Editable user database that can also be used byUserDatabaseRealm to authenticate users --> 37 38 39<Resource pathname="conf/tomcat-users.xml" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" description="User database that can be updated and saved" type="org.apache.catalina.UserDatabase" auth="Container" name="UserDatabase"/> 40 41</GlobalNamingResources> 42 43<!-- A "Service" is a collection of one or more "Connectors" that sharea single "Container" Note: A "Service" is not itself a "Container",so you may not define subcomponents such as "Valves" at this level.Documentation at /docs/config/service.html --> 44 45 46 47-<Service name="Catalina"> 48 49<!--The connectors can use a shared executor, you can define one or more named thread pools--> 50 51 52<!--<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"maxThreads="150" minSpareThreads="4"/> --> 53 54 55<!-- A "Connector" represents an endpoint by which requests are receivedand responses are returned. Documentation at :Java HTTP Connector: /docs/config/http.htmlJava AJP Connector: /docs/config/ajp.htmlAPR (HTTP/AJP) Connector: /docs/apr.htmlDefine a non-SSL/TLS HTTP/1.1 Connector on port 8080 --> 56 57 58<Connector port="8080" redirectPort="8443" connectionTimeout="20000" protocol="HTTP/1.1"/> 59 60<!-- A "Connector" using the shared thread pool--> 61 62 63<!--<Connector executor="tomcatThreadPool"port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443" /> --> 64 65 66<!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443This connector uses the NIO implementation. The defaultSSLImplementation will depend on the presence of the APR/nativelibrary and the useOpenSSL attribute of the AprLifecycleListener.Either JSSE or OpenSSL style configuration may be used regardless ofthe SSLImplementation selected. JSSE style configuration is used below. --> 67 68 69<!--<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"maxThreads="150" SSLEnabled="true"><SSLHostConfig><Certificate certificateKeystoreFile="conf/localhost-rsa.jks"type="RSA" /></SSLHostConfig></Connector> --> 70 71 72<!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2This connector uses the APR/native implementation which always usesOpenSSL for TLS.Either JSSE or OpenSSL style configuration may be used. OpenSSL styleconfiguration is used below. --> 73 74 75<!--<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"maxThreads="150" SSLEnabled="true" ><UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /><SSLHostConfig><Certificate certificateKeyFile="conf/localhost-rsa-key.pem"certificateFile="conf/localhost-rsa-cert.pem"certificateChainFile="conf/localhost-rsa-chain.pem"type="RSA" /></SSLHostConfig></Connector> --> 76 77 78<!-- Define an AJP 1.3 Connector on port 8009 --> 79 80 81<!--<Connector protocol="AJP/1.3"address="::1"port="8009"redirectPort="8443" /> --> 82 83 84<!-- An Engine represents the entry point (within Catalina) that processesevery request. The Engine implementation for Tomcat stand aloneanalyzes the HTTP headers included with the request, and passes themon to the appropriate Host (virtual host).Documentation at /docs/config/engine.html --> 85 86 87<!-- You should set jvmRoute to support load-balancing via AJP ie :<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> 88 89 90 91-<Engine name="Catalina" defaultHost="localhost"> 92 93<!--For clustering, please take a look at documentation at:/docs/cluster-howto.html (simple how to)/docs/config/cluster.html (reference documentation) --> 94 95 96<!--<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> --> 97 98 99<!-- Use the LockOutRealm to prevent attempts to guess user passwordsvia a brute-force attack --> 100 101 102 103-<Realm className="org.apache.catalina.realm.LockOutRealm"> 104 105<!-- This Realm uses the UserDatabase configured in the global JNDIresources under the key "UserDatabase". Any editsthat are performed against this UserDatabase are immediatelyavailable for use by the Realm. --> 106 107 108<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> 109 110</Realm> 111 112 113-<Host name="localhost" autoDeploy="true" unpackWARs="true" appBase="webapps"> 114 115<!-- SingleSignOn valve, share authentication between web applicationsDocumentation at: /docs/config/valve.html --> 116 117 118<!--<Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> 119 120 121<!-- Access log processes all example.Documentation at: /docs/config/valve.htmlNote: The pattern used is equivalent to using pattern="common" --> 122 123 124<Valve className="org.apache.catalina.valves.AccessLogValve" pattern="%h %l %u %t "%r" %s %b" suffix=".txt" prefix="localhost_access_log" directory="logs"/> 125 126</Host> 127 128</Engine> 129 130</Service> 131 132</Server> 133 134

補足情報(FW/ツールのバージョンなど)

jvm 17.0.4+8
tomcat 9.0.59

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問