- 浏览: 186272 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
cloverprince:
记得小学学过,“按级读,数的中间有多少0都只读一个‘零’,每级 ...
脑残系列之二:汉字转换数字 -
skying007:
...
模糊查询使用对索引的影响(2008.4.11面试) -
j1a1v1a1:
好
谢谢
SQL:根据第二张表字段值更新第一张表字段值(2008.4.11笔试) -
wxq594808632:
String str = "abc";
S ...
字符串反转 -
zhuqx1130:
这个是经典面试题
字符串反转
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this 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 with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed 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 and limitations under the License. Tomcat 5 Startup Sequence Sequence 1. Start from Command Line Class: org.apache.catalina.startup.Bootstrap What it does: a) Set up classloaders commonLoader (common)-> System Loader sharedLoader (shared)-> commonLoader -> System Loader catalinaLoader(server) -> commonLoader -> System Loader b) Load startup class (reflection) org.apache.catalina.startup.Catalina setParentClassloader -> sharedLoader Thread.contextClassloader -> catalinaLoader c) Bootstrap.daemon.init() complete Sequence 2. Process command line argument (start, startd, stop, stopd) Class: org.apache.catalina.startup.Bootstrap (assume command->start) What it does: a) Catalina.setAwait(true); b) Catalina.load() b1) initDirs() -> set properties like catalina.home catalina.base == catalina.home (most cases) b2) initNaming setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, org.apache.naming.java.javaURLContextFactory ->default) b3) createStartDigester() Configures a digester for the main server.xml elements like org.apache.catalina.core.StandardServer (can change of course :) org.apache.catalina.deploy.NamingResources Stores naming resources in the J2EE JNDI tree org.apache.catalina.LifecycleListener implements events for start/stop of major components org.apache.catalina.core.StandardService The single entry for a set of connectors, so that a container can listen to multiple connectors ie, single entry org.apache.coyote.tomcat5.CoyoteConnector Connectors to listen for incoming requests only It also adds the following rulesets to the digester NamingRuleSet EngineRuleSet HostRuleSet ContextRuleSet b4) Load the server.xml and parse it using the digester Parsing the server.xml using the digester is an automatic XML-object mapping tool, that will create the objects defined in server.xml Startup of the actual container has not started yet. b5) Assigns System.out and System.err to the SystemLogHandler class b6) Calls intialize on all components, this makes each object register itself with the JMX agent. During the process call the Connectors also initialize the adapters. The adapters are the components that do the request pre-processing. Typical adapters are HTTP1.1 (default if no protocol is specified, org.apache.coyote.http11.Http11Protocol) AJP1.3 for mod_jk etc. c) Catalina.start() c1) Starts the NamingContext and binds all JNDI references into it c2) Starts the services under <Server> which are: StandardService -> starts Engine (ContainerBase ->Logger,Loader,Realm,Cluster etc) c3) StandardHost (started by the service) Configures a ErrorReportValvem to do proper HTML output for different HTTP errors codes Starts the Valves in the pipeline (at least the ErrorReportValve) Configures the StandardHostValve, this valves ties the Webapp Class loader to the thread context it also finds the session for the request and invokes the context pipeline Starts the HostConfig component This component deploys all the webapps (webapps & conf/Catalina/localhost/*.xml) Webapps are installed using the deployer (StandardHostDeployer) The deployer will create a Digester for your context, this digester will then invoke ContextConfig.start() The ContextConfig.start() will process the default web.xml (conf/web.xml) and then process the applications web.xml (WEB-INF/web.xml) c4) During the lifetime of the container (StandardEngine) there is a background thread that keeps checking if the context has changed. If a context changes (timestamp of war file, context xml file, web.xml) then a reload is issued (stop/remove/deploy/start) d) Tomcat receives a request on an HTTP port d1) The request is received by a separate thread which is waiting in the PoolTcpEndPoint class. It is waiting for a request in a regular ServerSocket.accept() method. When a request is received, this thread wakes up. d2) The PoolTcpEndPoint assigns the a TcpConnection to handle the request. It also supplies a JMX object name to the catalina container (not used I believe) d3) The processor to handle the request in this case is Coyote Http11Processor, and the process method is invoked. This same processor is also continuing to check the input stream of the socket until the keep alive point is reached or the connection is disconnected. d4) The HTTP request is parsed using an internal buffer class (Coyote Http11 Internal Buffer) The buffer class parses the request line, the headers, etc and store the result in a Coyote request (not an HTTP request) This request contains all the HTTP info, such as servername, port, scheme, etc. d5) The processor contains a reference to an Adapter, in this case it is the Coyote Tomcat 5 Adapter. Once the request has been parsed, the Http11 processor invokes service() on the adapter. In the service method, the Request contains a CoyoteRequest and CoyoteRespons (null for the first time) The CoyoteRequest(Response) implements HttpRequest(Response) and HttpServletRequest(Response) The adapter parses and associates everything with the request, cookies, the context through a Mapper, etc d6) When the parsing is finished, the CoyoteAdapter invokes its container (StandardEngine) and invokes the invoke(request,response) method. This initiates the HTTP request into the Catalina container starting at the engine level d7) The StandardEngine.invoke() simply invokes the container pipeline.invoke() d8) By default the engine only has one valve the StandardEngineValve, this valve simply invokes the invoke() method on the Host pipeline (StandardHost.getPipeLine()) d9) the StandardHost has two valves by default, the StandardHostValve and the ErrorReportValve d10) The standard host valve associates the correct class loader with the current thread It also retrives the Manager and the session associated with the request (if there is one) If there is a session access() is called to keep the session alive d11) After that the StandardHostValve invokes the pipeline on the context associated with the request. d12) The first valve that gets invoked by the Context pipeline is the FormAuthenticator valve. Then the StandardContextValve gets invoke. The StandardContextValve invokes any context listeners associated with the context. Next it invokes the pipeline on the Wrapper component (StandardWrapperValve) d13) During the invokation of the StandardWrapperValve, the JSP wrapper (Jasper) gets invoked This results in the actual compilation of the JSP. And then invokes the actual servlet. e) Invokation of the servlet class
http://tomcat.apache.org/tomcat-6.0-doc/architecture/startup.html
发表评论
-
drools内存泄露问题排查分析
2009-12-13 14:12 5055一、现象 某系统使用了drools规则引擎对用 ... -
尝试给SOFA下的一个定义
2009-09-11 18:46 7361OSGI:服务与组件(Components & ... -
输出方法调用堆栈
2009-06-25 16:45 1838Throwable ex = new Th ... -
Tomcat debug模式启动
2008-11-09 21:59 20554在%CATALINA_HOME%\bin\startup.ba ... -
计算java对象大小
2008-10-14 20:43 2951/** * * http://hi.baidu. ... -
jmock入门
2008-10-04 16:45 2511package jmock; import juni ... -
svn回滚版本库
2008-09-20 15:35 3924这种情况下,有多种办法可以进行撤销修改。一般我们推荐用s ... -
实例化BeanFactory三种方法
2008-08-04 22:56 1731package com.test.spring; imp ... -
Spring定时任务
2008-07-30 09:10 1084<bean id="Schedul ... -
去掉重复值IO操作
2008-07-30 09:03 1383import java.io.BufferedReader ... -
基于Eclipse的Equinox框架开发OSGi Bundle应用
2008-07-27 19:35 4215一、创建Plug-in项目:osgiexample pac ... -
树形结构输出对象声明的所有属性键值
2008-07-13 21:01 1503/** * 获得Student对象声明的所有属性键 ... -
java日期处理
2008-04-20 15:32 2910一、获取系统时间两种方法 // 1、java.util ... -
JSR(转载)
2008-03-31 13:14 1170JSR是Java Specification Requests ... -
Java编译器对于String常量表达式的优化(转载)
2008-03-31 13:11 1070首先把问题摆出来,先看这个代码 String a = & ...
相关推荐
以下是如何将Tomcat的`startup.bat`脚本转换为系统服务的详细步骤: 1. 首先,确保你的系统环境配置正确。在安装Tomcat后,你需要设置几个环境变量: - `JAVA_HOME`: 指向JRE(Java Runtime Environment)的安装...
Tomcat之startup.bat详解 Tomcat的startup.bat文件是Tomcat服务器的启动文件,位于Tomcat的bin目录下。该文件是一个批处理文件,用于设置Tomcat服务器的环境变量和启动参数。在这个文件中,我们可以看到许多批处理...
### 双击startup.bat无法启动Tomcat的问题及解决方案 #### 问题概述 用户尝试通过双击`startup.bat`脚本来启动Tomcat服务器时遇到了问题,系统提示“JAVA_HOME environment variable is not defined correctly”。...
问题:使用免安装的tomcat双击startup.bat后,启动窗口一闪而过,而且tomcat服务未启动。 原因:在启动tomcat是需要读取环境变量和配置信息,缺少了这些信息,就不能登记环境变量,导致了tomcat的闪退。 解决办法: ...
1. `bin`:包含启动、停止和管理Tomcat的脚本,如`startup.sh`和`shutdown.sh`(Unix/Linux)或`startup.bat`和`shutdown.bat`(Windows)。 2. `conf`:存放服务器配置文件,如`server.xml`(定义服务器配置)、`...
使用Tomcat+Geoserver发布地图数据使用的工具包。将Geoserver解压后文件geoserver.war再次解压,然后放入Tomcat目录webapps目录下。最后运行Tomcat的bin目录下startup.bat启动Tomcat即可
免安装的tomcat双击startup.bat后,启动窗口一闪而过,而且tomcat服务未启动。 原因是:在启动tomcat是,需要读取环境变量和配置信息,缺少了这些信息,就不能登记环境变量,导致了tomcat的闪退。 解决办法: 1.在已...
#include <sys/ipc.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h>
5. **Tomcat安装目录权限问题**:如果Tomcat的安装目录没有足够的访问权限,也会影响其正常运行。 #### 三、解决方案 根据题目中提供的信息,我们可以看到一段经过修改的`startup.bat`脚本代码片段,通过这段代码...
5. `logs`目录:记录Tomcat运行时的日志信息。 6. `temp`目录:用于存放临时文件。 7. `work`目录:存放JSP编译后的类文件以及Servlet处理请求时生成的临时文件。 【启动Tomcat】 在命令行中,切换到`bin`目录下,...
tomcat startuptomcat startuptomcat startuptomcat startup
3. **启动与关闭**:使用bin目录下的startup.bat或startup.sh脚本启动Tomcat,使用shutdown.bat或shutdown.sh脚本关闭。在命令行中,也可以通过控制台输出监控Tomcat的状态。 4. **部署Web应用**:将WAR文件或整个...
- `startup.bat`和`startup.sh`:用于启动Tomcat服务,其中`.bat`版本适用于Windows系统,而`.sh`版本适用于Unix/Linux系统。 - `shutdown.bat`和`shutdown.sh`:用于停止正在运行中的Tomcat服务。 - 还包含其他...
5. 故障排查:遇到Tomcat启动一闪而过的情况时,可以通过查看Tomcat日志文件获取更多信息。日志文件通常位于Tomcat安装目录的logs文件夹下。通过阅读日志文件,可以找到导致Tomcat启动失败的具体原因,并根据错误...
如果不想以服务方式运行,但仍然想在命令行启动Tomcat而不显示窗口,可以在启动命令后添加`-startup`参数,例如:`startup.bat -startup`。这将在后台启动Tomcat,但仅适用于手动启动,不适合自动启动或远程操作。 ...
本篇文章将深入探讨如何实现"Tomcat自动定时重启"这一功能,以及提供的两个批处理文件——`Tomcat_startup.bat`和`Tomcat_shutdown.bat`的作用。 首先,`Tomcat_startup.bat`和`Tomcat_shutdown.bat`是Tomcat服务器...
平时启TOMCAT都是鼠标双击startup.bat了,很少看过里面写的是什么,也借学习TOMCAT的机会学习一下批处理的常用命令,不求都记住,但求以后再见到批处理命令能看的懂,说的出是干什么的。本文主要给大家介绍了关于...
### Tomcat5启动流程与配置详解 #### 一、Tomcat5.0目录结构 Tomcat作为一款广泛使用的开源Web服务器软件,其5.0版本的目录结构清晰且功能明确,便于用户理解和维护。以下是对Tomcat5.0各个目录的具体介绍: 1. *...
当在 Windows 平台上启动 Tomcat 的 `startup.bat` 脚本时一闪而过的情况通常是因为命令提示符窗口无法长时间保持打开,而不是 Tomcat 启动过程中出现了问题。