[질문] Tomcat에서 Context 지정시 문제...
요새 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을 이것저것 손 대보았지만 해결하지 못했고요,
도저히 문제점을 알 수가 없네요.
고수님들의 도움 바랍니다.
welcome-file-list를 추가해 보세요
welcome-file-list를 추가해 보세요
Welcome file list?
죄송하지만 무슨 뜻인지 잘 모르겠네요.
좀 더 자세히 말씀해 주시면 안 될까요?
http://kldp.org/KoreanDoc/html/Tomcat-KL
http://kldp.org/KoreanDoc/html/Tomcat-KLDP/Tomcat-KLDP-7.html
Re: [질문] Tomcat에서 Context 지정시 문제...
로그 파일을 확인해보시기 바랍니다. 어떤 오류로 인해 웹어플리케이션이 초기화되지 않았을 때도 그런 현상이 발생합니다.
그럼~
----------------------------
[서명] 그놈 한국 사용자 모임 - 그놈에 대한 모든 것! - 게시판, IRC, 위키, 갤러리 등등...
/ 가 빠진듯 하네요...
2) /etc/tomcat4/server.xml 수정
<Context path="" docBase="ROOT" debug="0">
여기에서,
<Context path="/" docBase="ROOT" debug="0">
슬래쉬가 빠진 것 같네요...
안녕하세요 ^^
댓글 달기