[질문] Tomcat에서 Context 지정시 문제...

bebem의 이미지

요새 Tomcat 설치로 골머리를 앓고 있습니다

현재까지 제가 한 작업은 다음과 같습니다.

1) install tomcat4 rpm files :
tomcat4-4.1.24-full.2jpp.noarch.rpm
tomcat4-webapps-4.1.24-full.2jpp.noarch.rpm
tomcat4-admin-webapps-4.1.24-full.2jpp.noarch.rpm

2) /etc/tomcat4/server.xml 수정
<Context path="" docBase="ROOT" debug="0"> 부분의 코멘트를 제거

3) ROOT 디렉토리 밑에 아래와 같이 파일 / 디렉토리 생성
----ROOT/
--------index.html
--------WEB-INF/
------------ web.xml
------------ classes/
----------------Test.java
----------------Test.class

4) index.html
<html>
<body>
<h1>Servlet Test</h1>
This is the document root of the http://localhost:8080.
<h2><a href=/Test>Run Test Servlet</a></h2>
</body>
</html>

5) web.xml
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>Test Servlet</display-name>
<description>
Test Servlet
</description>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>Test</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>

</web-app>

6) Test.java

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class Test extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("<html><head><title>Test Servlet</title></head>");
out.println("<body bgcolor=white><h1>Test Servlet</h1>");
out.println("</body></html>");
out.close();
}


public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request, response);
}
}

7) 톰캣 가동
# service tomcat4 start

이렇게 한 후 http://localhost:8080/
으로 접속을 하면

HTTP Status 404 - /

type Status report

message /

description The requested resource (/) is not available.
Apache Tomcat/4.1

와 같은 메시지가 나옵니다.

웃기는 것은 WEB-INF/web.xml을 지우면 정상적으로 index.html을 보여줍니다.
그리고 http://localhost:8080/examples 는 아무 문제 없이 작동을 하더군요...

web.xml을 이것저것 손 대보았지만 해결하지 못했고요,
도저히 문제점을 알 수가 없네요.

고수님들의 도움 바랍니다.

ddt의 이미지

welcome-file-list를 추가해 보세요

bebem의 이미지

죄송하지만 무슨 뜻인지 잘 모르겠네요.
좀 더 자세히 말씀해 주시면 안 될까요?

fender의 이미지

로그 파일을 확인해보시기 바랍니다. 어떤 오류로 인해 웹어플리케이션이 초기화되지 않았을 때도 그런 현상이 발생합니다.

그럼~

----------------------------
[서명] 그놈 한국 사용자 모임 - 그놈에 대한 모든 것! - 게시판, IRC, 위키, 갤러리 등등...

JCastle의 이미지

2) /etc/tomcat4/server.xml 수정
<Context path="" docBase="ROOT" debug="0">

여기에서,

<Context path="/" docBase="ROOT" debug="0">

슬래쉬가 빠진 것 같네요...

안녕하세요 ^^

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.