欢迎各位兄弟 发布技术文章
这里的技术是共享的
Servlet: CGI, java Servlet是一种CGI技术,能够使得java开发动态页面,并通过CGI的方式跟前端web通信,
硬编码, html Servlet对于所有的代码编码都是硬编码的,哪怕对html文档的定义也得由java程序来输出,这是非常麻烦的事,任何静态内容的修改也会导致我们的java编译器重新编译java应用程序,所以我们的java程序员必须明白html前端展示方式的定义,,,,
后来引入了jsp,jsp也是一种特殊的类,与servlet一样,jsp引入的主要功能是为了实现让java程序能够以标签(<% %<)的方式嵌入到html文档中去
jsp对应的程序是jsper,jsper主要目的是将.jsp转换成.java,这个.java程序是Servlet类的程序,
一般来讲就是将 JSP 翻译成Servlet,,,
所以jsp的运行得依赖于Servlet Container
如下图,jvm的外面封装了servlet(servlet能够理解cgi协议的请求,而且能够将请求在对应的jvm中执行,并且能够将执行的结果返回给请求者)
servlet在用户请求一个.java页的时候还能够将其编译为.class的字节码
如下图,因为servlet是硬编译,所以我们在servlet的外面增加了一个二层封装jsper(jsper将.jsp转换成.java,然后servlet将.java转换成.class)
如下图,jsp的容器称为web container(通常是定义java所定义的企业级或标准级别的兼容这些规范的应用),servlet的容器称为 servlet container,
任何一个web container通常都是遵循J2EE规范,并能够兼容J2EE规范中所有所提到的API的web应用程序(使用JSP语言所开发的程序能够部署并且能够运行起来的这么一种平台或框架)
Sun公司创建了第一个Servlet容器,即Java Web Server, 但JWS只是为了演示Servlet的相应功能,所以其很不稳定。与此同时,ASF创建了JServ项目,一个能够与apache整合起来的servlet容器。1999年,Sun把JWS捐给了ASF,于是两个项目合二为一,即今天Tomcat的前身。第一个tomcat版本是Tomcat 3.x系列,而发布于2001年Tomcat4.0则是在此前基础上进行了重新设计和实现,其代码项目被命名为Catalina。目前最新的版本则是7.x系列。
Java SE则包含了Java二进制程序(如JVM和Java字节码编译器)和Java的核心代码库,而Jave EE标准则包含了一组适用于创建企业级Web应用程序的API。Jave EE建立在Java SE的基础上,并依赖于Java SE才能正常工作。当然,任何级别的应用程序均能从Java EE中获益?????,但Jave EE却更适合解决大型软件系统设计中的问题。
JAVA EE包含多个独立的API,Servlet和JSP就是其中的两个,而JAVA EE中著名的API中还包含如下的几个:
JAVA EE APIs: (JAVA EE 包括自己的API和JAVA SE的API)
EJB(Enterprise JavaBeans):JAVA相关的诸多高级功能的实现,如RMI(Remote Method Invocation), 对象/关系映射,跨越多个数据源的分布式事务等;
JMS(Java Message Service):高性能异步消息服务,实现JAVA EE应用程序与非JAVA程序的“透明”通信;
JMX(Java Management Extensions):在程序运行时对其进行交互式监控和管理的机制;基于它可以开发很多监控程序,来监控JVM虚拟机的运行的
JTA(Java Transaction API):允许应用程序在自身的一个或多个组件中平滑地处理错误的机制;是一种实现自我故障处理的API
JavaMail:通过工业标准的POP/SMTP/IMAP协议发送和接收邮件的机制;
Java SE APIs: (Java SE包含 Java SE API + JDK)
JNDI(Java Naming and Directory Interface):用于与LDAP服务交互的API;
JAXP(Java API for XML Processing):用于分析及转换XML(基于XSLT实现);
Java SE API + JDK
JAVA EE Application Servers:常见的web container (web server)
Websphere: 商业级,最著名的,占有率30-40%,IBM公司研发
Weblogic: 商业级,早期是BEA(BEA从另一家小公司收购的),全球第二大,
oc4j: 商业级,Oracle的,10%左右,Oracle用83亿美元收购BEA,Weblogic变成了Oracle的, Weblogic加oc4j与Websphere差不多了
JBoss: 开源的,属于redhat,,,核心是tomcat,在tomcat基础上作了二次封装和开发,引入了某些新功能,尤其是企业级的某种应用接口,,,目前红帽对于JBoss也有认证培训,
JOnAS:
Geronimo:
Glassfish:玻璃鱼
risen:一个开源的web应用程序服务器,轻量级的,,比tomcat轻量级,在中小型电子商务公司里也有采用,不如tomcat受欢迎
java se,java ee 早期都是sun定义的规范,只定义了必须具有哪些api,才能说是 web应用程序服务器(web container),,,sun为了能够给大家演示一下功能如何实现,提供了一个jsp和servlet应用程序服务器,
TWS(马哥说好像是这个名字),大致具有java ee 最基本的仅具有 servlet 和jsp的演示性的应用程序服务器,
RI: Reference Implimentation
只是一个参考实现,不关心其是否稳定,是否可以在生产环境中使用,只是一个简单的模型而已,
ASF: Apache Software Foundation 阿帕其软件基金会
Jserv
TWS,ASF都是开源的,都很丑陋,,,,sun捐献TWS给了ASF,ASF揉合了TWS和Jserv,重新开发,
O'Reilly: 一个互联网著名的出版公司,邀请了Jserv所开发的一个程序员,写一本书,介绍这个重新开发???的项目,(O'Reilly很多书,封面是个动物,什么虫,鸟之类,它们给Jserv选的图是一个公猫,Tomcat,男猫),后来整个项目更名为Tomcat了,,,项目本身的代码叫catalina,后为改名为tomcat了,至今为止,tomcat的代码名称,还是叫catalina,只不过程序名称叫tomcat
马哥当时2013年tomcat最新版本是 7.0版本, 我现在2021是 10.1的版本,
tomcat4.0时就揉合了tws,Jserv,进行了重写,此时开始,tomcat变得稳定了,
tomcat5站稳了脚跟,
tomcat6.0足以在生产环境中使用了
tomcat7.0更历害了,
很多公司使有web应用程序服务器时,用tomcat,因为它开放,可以二次开发,
JBoss的核心也是tomcat
严格说来,tomcat并不算一个真正意义的j2ee的应用程序服务器,因为java ee 定义了很多api,tomcat好像仅实现了servlet和jsp,另外几个api好像都没有提供,,所以想使用全功能的应用程序服务器,最好用商业产品
但是绝大多部电子商务公司,无非是用servlet和jsp的api,所以tomcat虽然不完整,但是是一个非常流行的实现了
马哥仅讲tomcat
如下图,tomcat是一个应用程序服务器,应该包含 JVM,Servlet Container,Web Container,,,它就是一个 Web Container,它应该具有类似于web container一样的架构,组件,
如下图,tomcat的整体格式,
最外层,tomcat的实例(tomcat的server),每一个server就是一个tomcat实例,,,意味着启动一个tomcat,就是启动一个server,,叫做server还有一个原因,它是可以直接解析响应http请求的,,,,,server接受进来http请求之后,如果发现用户请求的是jsp页面,它要想办法把.jsp翻译成.java,编译成.class,这一切就是由引擎来完成的,,,所以引擎就是一个web container,就是一个 servlet container,,,web container其实是具有了解码jsp格式语言的一个容器,,,,,,,,,,,,server解码http请求的,如果发现用户访问的是jsp格式的页面,很显然,它要调用jsper转义成.java的格式,这一切的功能都由引擎来负责,,,,,,,,,,,,,,,,,,一个server内部可以启动两个java虚拟机,(两个引擎),,但是我们一般只启动一个,,,,既然一个server内部可以有多个引擎,它将请求发给哪个引擎?所以要有一种机制将server和引擎建立起关联关系,能够将server接受过来的请求转发给哪个引擎,我们称之为连接器connector,连接器类型有很多种(http连接器,https连接器,ajp连接器,代理连接器),,一个server可以实现将发往不同连接器(如 http连接器,https连接器 )的请求转发给同一个引擎,一个server可以将多个连接器同时关联到同一个引擎上去,,,,一个server可以有多个引擎,如何定义哪个连接器连接哪个引擎???
向内一层 tomcat的service,,服务,,,,service的主要目的就是将一个或多个连接器关联至某引擎的,,,一个service内部只能有一个引擎,,,,,如果一个server里面可以有多个引擎,意味着,一个server里面可以有多个service,,,,,,但是通常情况下,在tomcat内部只有一个service,也只有一个引擎,但是可以有多个连接器(将对某一种特定协议的请求关联到某一个container(引擎)上面去)
再向内一层 tomcat的引擎, Engine,,就是一个servlet container的实现,还有别的功能,解码(别人发来的http的请求,要实现jsp的功能,意味着要在 web服务器上使用了,要在http协议上工作了,,,所以必须要有很多理解http协议的基本组件,,,由此tomcat就在自己内部开发一个使用java语言开发一个web服务器, 这个web服务器可以直接工作在前台,可以工作在80端口上,)Engine,,就是一个servlet container,真正对jsp页面的访问,.jsp转换成.java,转换成.class,最终要在JVM上运行,,,,servlet container 可以理解成具有servlet功能的java 虚拟机,所以需要在外部部署类加载器,将java的类加载进来,在其内部执行的,,,,,这里的引擎就是具有了web container功能的一个容器,它的主要目的是 servlet container,,,,,,,,,,,引擎也是最外层的被称为容器的组件,server被称为顶级组件,,,,,,引擎是也是最外层的被称为容器的组件,,,容器就是能够解码能够执行jsp或java程序的JVM,,,,所以引擎这个位置才是真正的虚拟机(java 虚拟机)所在的位置,,,,,,,,引擎是一个容器内组件
再向内一层 tomcat的主机,Host 一个引擎内部可以有多个主机,,,,,,,,一个引擎就是一个JVM的实例,就相当于运行的一个web服务器进程,,,,,,,Host就是用来在引擎内部实现虚拟主机的,,,,,,,,,一个引擎内部可以有多个主机,一个用户请求从外部连接进来了,这个请求只说请求的是ip地址,没说请求的是哪个虚拟主机,那么用默认虚拟主机来返回,,,,,,定义引擎的时候要定义一个默认主机,,,,,,,,,tomcat是主机是重量级的,每一个Host需要众多属性来定义
主机内部可以有上下文context,,,,,,,,在apache上,我们可以定义路径别名,我们找了一个本来不在我们这个对应的虚拟主机的根文档路径下的其它路径用于实现通过这么个url,照样可以访问,这里我们就称为上下文,它的主要功能就是用来定义类似于apache的路径别名的,,,,但是不完全相同,马哥这样解释,我们容易理解,,,,,一个host内部可以有多个context,我们无非就是定义多个别名而已,,,,,事实上在java内部,每一个context,都可以单独部署一个应用程序的,,,量级大,每一个应用程序,需要专门的去部署它,,,,,,,因为每一个tomcat的应用程序,都是依赖于公共类和私有类,它的类要完成装载以后,程序才能运行的,所以它依赖的额外操作,不像php一样,(php程序只要开发完,就能运行,不需要很多额外的资源),而java比较重量级....所以java要定义一下专门的组件context来专门描述一个应用程序倒底该怎么去部署的这么一个组件,
Document Root /web/htdocs/discuz 假设域名 www.magedu.com
alias /phpwind
/web/bbs/phpwind 这里可以放单独的应用程序,,,php程序量级小
这里 http://www.magedu.com/phpwind 就可以访问了,,这里 /web/bbs/phpwind路径不属于/web/htdocs/discuz
Engine,Host,context都可以容纳一个应用程序并部署执行的
容器类组件:
Engine(顶级的容器类组件),Host,context
顶级组件:
Server, Service
其它组件:
也是java类,是用来实现各种不同的子功能,
比如基于用户的认证(帐号和密码)
Realm(翻译为领域)组件,对于tomcat来讲,realm就是一个用户帐号数据库
Valve(翻译为阀门)组件,Valve组件,能实现的认证很多,是一类组件,在这些组件中,不同的实现方式可以完成不同的功能,
比如 记录访问日志,,基于ip的认证等,
而且Valve还是一个过滤器,记录访问日志的时候,我们可以明确说明白,哪些日志可以记录下来,哪些日志不能记录,,,基于ip的认证也是一个过滤器,过滤ip地址来源的,,,,如下图,所以在这几个容器内部,它们都可以使用类似的组件,比如我们可以在Engine上定义一个realm,说明白你只要访问这么一个引擎类的所有程序都得使用帐号密码,,,,如果在Host上定义一个realm,那么访问这个主机上的应用程序要提供账号密码,,,,,,同理在context上,使用realm,则访问这个context上的应用程序得提供账号密码,,,,阀门也是一个道理,在引擎上可以使用Valve,在Host,context下也可以定义Valve,
Logger:日志记录器,用于定义日志文件在哪里,叫什么名字,最大多大,如何进行滚动等
如下图,一个server内部可以有多个service,一个service可以将多个conector组件关联到一个引擎上来,一个引擎内部可以有多个host,一个host内部可以有多个context,(下图只画了一个),,,,在多个组件内部可以有其它组件,realm,valve在三个容器内都可以有, 但是logger日志记录器不能用于context,这是logger与一般组件不一样的地方
valve是说明哪些日志信息可以记录的,valve是个过滤器,比如日志级别有info,debug,error, valve相当于说只有error级别的才需要记录,,,,,由logger来完成将日志写到需要的地方.
其它组件
9、GlobalNamingResources 全局命名资源
应用于整个服务器的JNDI映射 (用来跟LDAP关联的,了解就行,不必深究),此可以避免每个Web应用程序都需要在各自的web.xml创建,这在web应用程序以WAR的形式存在时尤为有用。它通常可以包含三个子元素:
1) Environment;
2) Resource;
3) ResourceEnvRef;
10、WatchedResource 被监控的资源,有一点的改变,就会通知其它需要监控它的资源
WatchedResource可以用于Context?????(仅仅是Context)中监视指定的webapp程序文件的改变,并且能够在监视到文件内容发生改变时重新装载此文件。一般来讲,任意应用程序都应该是WatchedResource
11、Listener 监听,,
Listener用于创建和配置LifecycleListener对象,而LifecycleListener通常被开发人员用来创建和删除容器。这个用得不多
11、Loader 类加载器
Java的动态装载功能是其语言功能强大表现之一,Servlet容器使用此功能在运行时动态装载servlet和它们所依赖的类。Loader可以用于Context中控制java类的加载。
12、Manager
Manger对象用于实现HTTP会话管理的功能,Tomcat6中有5种Manger的实现:
1) StandardManager 标准管理器 持久的
Tomcat6的默认会话管理器,用于非集群环境中对单个处于运行状态的Tomcat实例会话进行管理。当Tomcat关闭时,这些会话相关的数据会被写入磁盘上的一个名叫SESSION.ser的文件,并在Tomcat下次启动时读取此文件。
2) PersistentManager 也是持久的
当一个会话长时间处于空闲状态时会被写入到swap会话对象,这对于内存资源比较吃紧的应用环境来说比较有用。
3)DeltaManager
用于Tomcat集群的会话管理器,它通过将改变了会话数据同步给集群中的其它节点实现会话复制。这种实现会将所有会话的改变同步给集群中的每一个节点,也是在集群环境中用得最多的一种实现方式。缺点:每一个有数据,会同步到其它所有节点,太消耗资源
4) BackupManager #每一个有数据,只同步到下一个,节约内存和带宽
用于Tomcat集群的会话管理器,与DeltaManager不同的是,某节点会话的改变只会同步给集群中的另一个而非所有节点。
5)SimpleTcpReplicationManager
Tomcat4时用到的版本,过于老旧了。
13、Stores #session存在哪里
PersistentManager必须包含一个Store元素以指定将会话数据存储至何处。这通常有两种实现方式:FileStore和JDBCStore。
14、Resources 资源
经常用于实现在Context中指定需要装载的但不在Tomcat本地磁盘上的应用资源?????,如Java类,HTML页面,JSP文件等。
15、Cluster #专用于集群的元素,里面有很多子组件
专用于配置Tomcat集群的元素,可用于Engine和Host容器中。在用于Engine容器中时,Engine中的所有Host均支持集群功能。在Cluster元素中,需要直接定义一个Manager元素,这个Manager元素有一个其值为org.apache.catalina.ha.session.DeltaManager或org.apache.catalina.ha.session.BackupManager的className属性。同时,Cluster中还需要分别定义一个Channel和ClusterListener元素。
15.1、Channel #传递心跳信息的通道,也就是定义一个组播地址
用于Cluster中给集群中同一组中的节点定义通信“信道”。Channel中需要至少定义Membership、Receiver和Sender三个元素,此外还有一个可选元素Interceptor。
15.2、Membership #集群成员关系管理
用于Channel中配置同一通信信道上节点集群组中的成员情况,即监控加入当前集群组中的节点并在各节点间传递心跳信息,而且可以在接收不到某成员的心跳信息时将其从集群节点中移除。Tomcat6中Membership的实现是org.apache.catalina.tribes.membership.McastService。
15.3、Sender #发送心跳
用于Channel中配置“复制信息”的发送器,实现发送需要同步给其它节点的数据至集群中的其它节点。发送器不需要属性的定义,但可以在其内部定义一个Transport元素。
15.4 Transport #如何传送自己的集群事务信息的
用于Sender内部,配置数据如何发送至集群中的其它节点。Tomcat6有两种Transport的实现:
1) PooledMultiSender
基于Java阻塞式IO,可以将一次将多个信息并发发送至其它节点,但一次只能传送给一个节点。
2)PooledParallelSener
基于Java非阻塞式IO,即NIO,可以一次发送多个信息至一个或多个节点。
15.5 Receiver #怎么去接受其它人传递过来的心跳或者事实信息
用于Channel定义某节点如何从其它节点的Sender接收复制数据,Tomcat6中实现的接收方式有两种BioReceiver和NioReceiver。
tomcat本身是用java开发的,内部所有组件都是java程序
server本身里面有个 web 服务器组件,可以理解成http连接器,如下图
tomcat的部署方式,如下图,有两种
可以把nginx或apache 与 tomcat分别在不同的服务器上,如下图,
假设是apache+tomcat,apache是反向代理,,
apache与tomcat是同一家公司的产品,技术比较融洽
apache里的代理模块叫mod_proxy,mode_jk????两个都能集群连到后端的tomcat,
apache转发时,可根据流量来判定,或其它标准来判定挑哪个后台的tomcat,挑法比较独特,确好跟服务器自身的流量相关????而且也能够监控后端服务器的健康状况,并通过一个web接口输出一个管理页面,在管理页面实现禁用或启用后端的tomcat服务器,,
通常指的tomcat的集群,也是指的apache以反向代理的方式基于某种模块将用户请求代理至后端tomcat的集群,
如下图借助于mod_proxy,能将用户的请求以二进制方式发向后台tomcat,(nginx的反向代理,只能http协议)
apache可以使用ajp协议(apache jserve protocol),这是二进制,效率高
如果是nginx+tomcat,那么可以将几个tomcat做成upstream组,反向代理时,以http协议,基于某种算法,负载均衡也可以,静态的nginx自己处理,动态的(.java .do)转到后台的tomcat
tomcat配置文件, server.xml,它是核心配置文件,
server.xml:
Tomcat各组件间的关系:
<Server>
<Service>
<Connector />
<Engine>
<Host>
<Context> </Context>
</Host>
</Engine>
</Service>
</Server>
tomcat要先配置好jdk,(不是jre),,因为它依赖于开发环境,java程序要转换要编译才能运行的,而jre只是运行环境
安装tomcat的方法
1)rpm包
2)通用二进制
3)源码编译安装, 有点困难
[root@master ~]# mount /dev/cdrom /media/cdrom/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@master ~]# yum list all | grep tomcat #看系统自带的tomcat
apache-tomcat-apis.noarch 0.1-1.el6 Base
jakarta-commons-dbcp-tomcat5.noarch 1.2.1-13.9.el6 Base
jakarta-commons-pool-tomcat5.i686 1.3-12.7.el6 Base
tomcat6.noarch 6.0.24-111.el6_9 Base
tomcat6-el-2.1-api.noarch 6.0.24-111.el6_9 Base
tomcat6-jsp-2.1-api.noarch 6.0.24-111.el6_9 Base
tomcat6-lib.noarch 6.0.24-111.el6_9 Base
tomcat6-servlet-2.5-api.noarch 6.0.24-111.el6_9 Base
tomcatjss.noarch 2.1.0-4.el6 Base
[root@master ~]#
到官方看看下载
https://tomcat.apache.org/download-70.cgi
https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.tar.gz
[root@master ~]# wget https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.tar.gz
--2021-06-26 08:56:45-- https://mirrors.bfsu.edu.cn/apache/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.tar.gz
正在解析主机 mirrors.bfsu.edu.cn... 39.155.141.16, 2001:da8:20f:4435:4adf:37ff:fe55:2840
正在连接 mirrors.bfsu.edu.cn|39.155.141.16|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:9656576 (9.2M) [application/octet-stream]
正在保存至: “apache-tomcat-7.0.109.tar.gz”
100%[======================================>] 9,656,576 9.14M/s in 1.0s
2021-06-26 08:56:46 (9.14 MB/s) - 已保存 “apache-tomcat-7.0.109.tar.gz” [9656576/9656576])
[root@master ~]#
用法与mysql类似
[root@master ~]# tar xf apache-tomcat-7.0.109.tar.gz -C /usr/local
[root@master ~]#
[root@master local]# ln -sv apache-tomcat-7.0.109 tomcat
"tomcat" -> "apache-tomcat-7.0.109"
[root@master local]#
[root@master local]# cd tomcat/
[root@master tomcat]# ls
bin CONTRIBUTING.md logs RELEASE-NOTES webapps
BUILDING.txt lib NOTICE RUNNING.txt work
conf LICENSE README.md temp
[root@master tomcat]#
[root@master tomcat]# ll
总用量 152
drwxr-x---. 2 root root 4096 6月 26 09:08 bin #二进制 程序路径
-rw-r-----. 1 root root 17849 4月 23 02:45 BUILDING.txt
drwx------. 2 root root 4096 4月 23 02:45 conf
-rw-r-----. 1 root root 5586 4月 23 02:45 CONTRIBUTING.md
drwxr-x---. 2 root root 4096 6月 26 09:08 lib
-rw-r-----. 1 root root 56846 4月 23 02:45 LICENSE
drwxr-x---. 2 root root 4096 4月 23 02:43 logs
-rw-r-----. 1 root root 1281 4月 23 02:45 NOTICE
-rw-r-----. 1 root root 3257 4月 23 02:45 README.md
-rw-r-----. 1 root root 9362 4月 23 02:45 RELEASE-NOTES
-rw-r-----. 1 root root 17251 4月 23 02:45 RUNNING.txt
drwxr-x---. 2 root root 4096 6月 26 09:08 temp
drwxr-x---. 7 root root 4096 4月 23 02:45 webapps
drwxr-x---. 2 root root 4096 4月 23 02:43 work
[root@master tomcat]#
[root@master tomcat]# ls bin/ #一大堆脚本和jar文件 (jar是归档压缩包,里面是一大堆的java库)(tomcat本身是java写的,启动自己就需要一些库) .bat是windows的批处理脚本 .sh是shell脚本,,,,tomcat本身的代理是catalina????,,其它的脚本可独立执行,也可以用核心脚本去调用它们
bootstrap.jar daemon.sh startup.sh
catalina.bat digest.bat tomcat-juli.jar
catalina.sh(核心脚本) digest.sh tomcat-native.tar.gz
catalina-tasks.xml setclasspath.bat tool-wrapper.bat
commons-daemon.jar setclasspath.sh tool-wrapper.sh
commons-daemon-native.tar.gz shutdown.bat version.bat
configtest.bat shutdown.sh version.sh
configtest.sh startup.bat
[root@master tomcat]#
[root@master tomcat]# ls conf/ #配置文件
catalina.policy context.xml server.xml(核心配置文件) tomcat-users.xsd
catalina.properties logging.properties tomcat-users.xml(用户配置文件,realm,基于文件或基于内存的认证机制,tomcat启动后会直接读它进内存,并在内存中完成用户帐号认证,密码检测等功能,这个文件安全性很重要) web.xml
[root@master tomcat]#
[root@master tomcat]# ll conf/ #下面文件都不允许读
总用量 216
-rw-------. 1 root root 13342 4月 23 02:45 catalina.policy #定义tomcat自身的安全策略
-rw-------. 1 root root 6776 4月 23 02:45 catalina.properties #定义catalina(应用程序自己)属性
-rw-------. 1 root root 1394 4月 23 02:45 context.xml #默认为上下文提供的配置文件
-rw-------. 1 root root 3562 4月 23 02:45 logging.properties #定义日志属性
-rw-------. 1 root root 6689 4月 23 02:45 server.xml
-rw-------. 1 root root 2164 4月 23 02:45 tomcat-users.xml
-rw-------. 1 root root 2633 4月 23 02:45 tomcat-users.xsd
-rw-------. 1 root root 170681 4月 23 02:45 web.xml #默认的应用程序部署描述符??????
[root@master tomcat]#
部署应用程序,就是放它到某一个context或host能够访问的路径下,并能够将其所依赖的公共类或私有类装载完成的过程
换句话说,将一个web应用程序所依赖到的类装载进JVM
部署后,应用程序才能够被访问
部署描述符定义了支持哪些mime,到哪里找什么文件等????
每一个应用程序都应该有自己独立的部署描述符,若没有,就继承默认的
[root@master tomcat]# cat conf/context.xml #这里面是空的,难道它是默认的吗????
<?xml version='1.0' encoding='utf-8'?>
<!--
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.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
</Context>
[root@master tomcat]#
[root@master tomcat]# cat conf/catalina.properties #定义catalina(应用程序自己)属性,比如内存大小,字符串缓冲池?????大小等
# 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.
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.jasper.,\
org.apache.naming.resources.,org.apache.tomcat.
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageDefinition unless the
# corresponding RuntimePermission ("defineClassInPackage."+package) has
# been granted.
#
# by default, no packages are restricted for definition, and none of
# the class loaders supplied with the JDK call checkPackageDefinition.
#
package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,\
org.apache.jasper.,org.apache.naming.,org.apache.tomcat.
#
#
# List of comma-separated paths defining the contents of the "common"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank,the JVM system loader will be used as Catalina's "common"
# loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
#
# List of comma-separated paths defining the contents of the "server"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank, the "common" loader will be used as Catalina's "server"
# loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
server.loader= #加载器是什么
#
# List of comma-separated paths defining the contents of the "shared"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
# the "common" loader will be used as Catalina's "shared" loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
# Please note that for single jars, e.g. bar.jar, you need the URL form
# starting with file:.
shared.loader=
# List of JAR files that should not be scanned using the JarScanner
# functionality. This is typically used to scan JARs for configuration
# information. JARs that do not contain such information may be excluded from
# the scan to speed up the scanning process. This is the default list. JARs on
# this list are excluded from all scans. Scan specific lists (to exclude JARs
# from individual scans) follow this. The list must be a comma separated list of
# JAR file names.
# The JARs listed below include:
# - Tomcat Bootstrap JARs
# - Tomcat API JARs
# - Catalina JARs
# - Jasper JARs
# - Tomcat JARs
# - Common non-Tomcat JARs
# - Test JARs (JUnit, Cobertura and dependencies)
tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
annotations-api.jar,\
ant-junit*.jar,\
ant-launcher.jar,\
ant.jar,\
asm-*.jar,\
aspectj*.jar,\
bootstrap.jar,\
catalina-ant.jar,\
catalina-ha.jar,\
catalina-jmx-remote.jar,\
catalina-tribes.jar,\
catalina-ws.jar,\
catalina.jar,\
cobertura-*.jar,\
commons-beanutils*.jar,\
commons-codec*.jar,\
commons-collections*.jar,\
commons-daemon.jar,\
commons-dbcp*.jar,\
commons-digester*.jar,\
commons-fileupload*.jar,\
commons-httpclient*.jar,\
commons-io*.jar,\
commons-lang*.jar,\
commons-logging*.jar,\
commons-math*.jar,\
commons-pool*.jar,\
dom4j-*.jar,\
ecj-*.jar,\
el-api.jar,\
geronimo-spec-jaxrpc*.jar,\
h2*.jar,\
hamcrest-*.jar,\
hibernate*.jar,\
httpclient*.jar,\
icu4j-*.jar,\
jasper-el.jar,\
jasper.jar,\
jaxb-*.jar,\
jaxen-*.jar,\
jdom-*.jar,\
jetty-*.jar,\
jmx-tools.jar,\
jmx.jar,\
jsp-api.jar,\
jstl.jar,\
jta*.jar,\
junit-*.jar,\
junit.jar,\
log4j-1*.jar,\
log4j*.jar,\
mail*.jar,\
org.hamcrest.*.jar,\
oraclepki.jar,\
oro-*.jar,\
servlet-api-*.jar,\
servlet-api.jar,\
slf4j*.jar,\
taglibs-standard-spec-*.jar,\
tagsoup-*.jar,\
tomcat-api.jar,\
tomcat-coyote.jar,\
tomcat-dbcp.jar,\
tomcat-i18n-*.jar,\
tomcat-jdbc.jar,\
tomcat-jni.jar,\
tomcat-juli-adapters.jar,\
tomcat-juli.jar,\
tomcat-spdy.jar,\
tomcat-util.jar,\
tools.jar,\
websocket-api.jar,\
wsdl4j*.jar,\
xercesImpl.jar,\
xml-apis.jar,\
xmlParserAPIs-*.jar,\
xmlParserAPIs.jar,\
xom-*.jar
# Additional JARs (over and above the default JARs listed above) to skip when
# scanning for Servlet 3.0 pluggability features. These features include web
# fragments, annotations, SCIs and classes that match @HandlesTypes. The list
# must be a comma separated list of JAR file names.
org.apache.catalina.startup.ContextConfig.jarsToSkip=
# Additional JARs (over and above the default JARs listed above) to skip when
# scanning for TLDs. The list must be a comma separated list of JAR file names.
org.apache.catalina.startup.TldConfig.jarsToSkip=tomcat7-websocket.jar
#
# String cache configuration.
tomcat.util.buf.StringCache.byte.enabled=true
#tomcat.util.buf.StringCache.char.enabled=true
#tomcat.util.buf.StringCache.trainThreshold=500000
#tomcat.util.buf.StringCache.cacheSize=5000
# This system property is deprecated. Use the relaxedPathChars relaxedQueryChars
# attributes of the Connector instead. These attributes permit a wider range of
# characters to be configured as valid.
# Allow for changes to HTTP request validation
# WARNING: Using this option may expose the server to CVE-2016-6816
#tomcat.util.http.parser.HttpParser.requestTargetAllow=|
[root@master tomcat]#
[root@master tomcat]# cat conf/logging.properties #日志级别,日志文件路径等
# 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.
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.Fil eHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.Fi leHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHand ler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
1catalina.org.apache.juli.FileHandler.encoding = UTF-8
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
2localhost.org.apache.juli.FileHandler.encoding = UTF-8
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.
3manager.org.apache.juli.FileHandler.encoding = UTF-8
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
4host-manager.org.apache.juli.FileHandler.encoding = UTF-8
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.encoding = UTF-8
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localh ost.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handler s = 3manager.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].le vel = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].ha ndlers = 4host-manager.org.apache.juli.FileHandler
# For example, set the org.apache.catalina.util.LifecycleBase logger to log
# each component that extends LifecycleBase changing state:
#org.apache.catalina.util.LifecycleBase.level = FINE
# To see debug messages in TldLocationsCache, uncomment the following line:
#org.apache.jasper.compiler.TldLocationsCache.level = FINE
[root@master tomcat]#
[root@master tomcat]# vim conf/catalina.policy #用来定义安全策略,哪些资源可以通过互联网访问,哪些不可以,,,,哪些能够被装载,哪些不能,,,主要是安全以及授权相关的定义
// 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.
// ============================================================================
// catalina.policy - Security Policy Permissions for Tomcat 7
//
// This file contains a default set of security policies to be enforced (by the
// JVM) when Catalina is executed with the "-security" option. In addition
// to the permissions granted here, the following additional permissions are
// granted to each web application:
//
// * Read access to the web application's document root directory
// * Read, write and delete access to the web application's working directory
// ============================================================================
// ========== SYSTEM CODE PERMISSIONS =========================================
// These permissions apply to javac
grant codeBase "file:${java.home}/lib/-" {
permission java.security.AllPermission;
};
// These permissions apply to all shared system extensions
grant codeBase "file:${java.home}/jre/lib/ext/-" {
permission java.security.AllPermission;
};
// These permissions apply to javac when ${java.home} points at $JAVA_HOME/jre
grant codeBase "file:${java.home}/../lib/-" {
permission java.security.AllPermission;
};
// These permissions apply to all shared system extensions when
// ${java.home} points at $JAVA_HOME/jre
grant codeBase "file:${java.home}/lib/ext/-" {
permission java.security.AllPermission;
};
// ========== CATALINA CODE PERMISSIONS =======================================
// These permissions apply to the daemon code
grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
permission java.security.AllPermission;
};
// These permissions apply to the logging API
// Note: If tomcat-juli.jar is in ${catalina.base} and not in ${catalina.home},
// update this section accordingly.
// grant codeBase "file:${catalina.base}/bin/tomcat-juli.jar" {..}
grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
permission java.io.FilePermission
"${java.home}${file.separator}lib${file.separator}logging.properties", "read";
permission java.io.FilePermission
"${catalina.base}${file.separator}conf${file.separator}logging.properties", "read";
permission java.io.FilePermission
"${catalina.base}${file.separator}logs", "read, write";
permission java.io.FilePermission
"${catalina.base}${file.separator}logs${file.separator}*", "read, write, delete";
permission java.lang.RuntimePermission "shutdownHooks";
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.util.logging.LoggingPermission "control";
permission java.util.PropertyPermission "java.util.logging.config.class", "read";
permission java.util.PropertyPermission "java.util.logging.config.file", "read";
permission java.util.PropertyPermission "org.apache.juli.ClassLoaderLogManager.debug", "read";
permission java.util.PropertyPermission "catalina.base", "read";
// Note: To enable per context logging configuration, permit read access to
// the appropriate file. Be sure that the logging configuration is
// secure before enabling such access.
// E.g. for the examples web application (uncomment and unwrap
// the following to be on a single line):
// permission java.io.FilePermission "${catalina.base}${file.separator}
// webapps${file.separator}examples${file.separator}WEB-INF
// ${file.separator}classes${file.separator}logging.properties", "read";
};
// These permissions apply to the server startup code
grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
permission java.security.AllPermission;
};
// These permissions apply to the servlet API classes
// and those that are shared across all class loaders
// located in the "lib" directory
grant codeBase "file:${catalina.home}/lib/-" {
permission java.security.AllPermission;
};
// If using a per instance lib directory, i.e. ${catalina.base}/lib,
// then the following permission will need to be uncommented
// grant codeBase "file:${catalina.base}/lib/-" {
// permission java.security.AllPermission;
// };
// ========== WEB APPLICATION PERMISSIONS =====================================
// These permissions are granted by default to all web applications
// In addition, a web application will be given a read FilePermission
// and JndiPermission for all files and directories in its document root.
grant {
// Required for JNDI lookup of named JDBC DataSource's and
// javamail named MimePart DataSource used to send mail
permission java.util.PropertyPermission "java.home", "read";
permission java.util.PropertyPermission "java.naming.*", "read";
permission java.util.PropertyPermission "javax.sql.*", "read";
// OS Specific properties to allow read access
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
permission java.util.PropertyPermission "file.separator", "read";
permission java.util.PropertyPermission "path.separator", "read";
permission java.util.PropertyPermission "line.separator", "read";
// JVM properties to allow read access
permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "java.specification.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";
permission java.util.PropertyPermission "java.vm.specification.version", "read";
permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
permission java.util.PropertyPermission "java.vm.specification.name", "read";
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
// Required for OpenJMX
permission java.lang.RuntimePermission "getAttribute";
// Allow read of JAXP compliant XML parser debug
permission java.util.PropertyPermission "jaxp.debug", "read";
// All JSPs need to be able to read this package
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat";
// Precompiled JSPs need access to these packages.
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.el";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
permission java.lang.RuntimePermission
"accessClassInPackage.org.apache.jasper.runtime.*";
// Precompiled JSPs need access to these system properties.
// The following two permissions are no longer needed since Tomcat 7.0.88
// They are here for historic reasons. There is no harm in keeping them.
permission java.util.PropertyPermission
"org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read";
permission java.util.PropertyPermission
"org.apache.el.parser.COERCE_TO_ZERO", "read";
// The cookie code needs these.
permission java.util.PropertyPermission
"org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "read";
permission java.util.PropertyPermission
"org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING", "read";
permission java.util.PropertyPermission
"org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR", "read";
// Applications using Comet need to be able to access this package
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.comet";
// Applications using the legacy WebSocket implementation need to be able to access this package
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.websocket";
// Applications using the JSR-356 WebSocket implementation need to be able to access these packages
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.websocket";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.websocket.server";
};
// The Manager application needs access to the following packages to support the
// session display functionality. It also requires the custom Tomcat
// DeployXmlPermission to enable the use of META-INF/context.xml
// These settings support the following configurations:
// - default CATALINA_HOME == CATALINA_BASE
// - CATALINA_HOME != CATALINA_BASE, per instance Manager in CATALINA_BASE
// - CATALINA_HOME != CATALINA_BASE, shared Manager in CATALINA_HOME
grant codeBase "file:${catalina.base}/webapps/manager/-" {
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
permission org.apache.catalina.security.DeployXmlPermission "manager";
};
grant codeBase "file:${catalina.home}/webapps/manager/-" {
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
permission org.apache.catalina.security.DeployXmlPermission "manager";
};
// The Host Manager application needs the custom Tomcat DeployXmlPermission to
// enable the use of META-INF/context.xml
// These settings support the following configurations:
// - default CATALINA_HOME == CATALINA_BASE
// - CATALINA_HOME != CATALINA_BASE, per instance Host Manager in CATALINA_BASE
// - CATALINA_HOME != CATALINA_BASE, shared Host Manager in CATALINA_HOME
grant codeBase "file:${catalina.base}/webapps/host-manager/-" {
permission org.apache.catalina.security.DeployXmlPermission "host-manager";
};
grant codeBase "file:${catalina.home}/webapps/host-manager/-" {
permission org.apache.catalina.security.DeployXmlPermission "host-manager";
};
// You can assign additional permissions to particular web applications by
// adding additional "grant" entries here, based on the code base for that
// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
//
// Different permissions can be granted to JSP pages, classes loaded from
// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
//
// For instance, assume that the standard "examples" application
// included a JDBC driver that needed to establish a network connection to the
// corresponding database and used the scrape taglib to get the weather from
// the NOAA web server. You might create a "grant" entries like this:
//
// The permissions granted to the context root directory apply to JSP pages.
// grant codeBase "file:${catalina.base}/webapps/examples/-" {
// permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
// permission java.net.SocketPermission "*.noaa.gov:80", "connect";
// };
//
// The permissions granted to the context WEB-INF/classes directory
// grant codeBase "file:${catalina.base}/webapps/examples/WEB-INF/classes/-" {
// };
//
// The permission granted to your JDBC driver
// grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
// permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
// };
// The permission granted to the scrape taglib
// grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
// permission java.net.SocketPermission "*.noaa.gov:80", "connect";
// };
[root@master tomcat]# ls conf/ #我们通常只需修改xml格式的文档,除非要定义服务器自身的运行属性,否则不必改其它文件
catalina.policy context.xml server.xml tomcat-users.xsd
catalina.properties logging.properties tomcat-users.xml web.xml
[root@master tomcat]#
[root@master tomcat]# vim conf/server.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
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.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN"> #server有个管理接口,可以使用telnet来访问,telnet 8005端口,发个SHUTDOWN命令,就可以停掉tomcat,,为了安全,所以要关掉,关掉telnet还是关掉其它什么????
<Listener className="org.apache.catalina.startup.VersionLoggerListener" /> #这些Listener 这些是程序员调试时,监听,关闭或开启某个容器组件,不用管它
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources> #全局命名资源
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" /> # 用户认证时用到
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a 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
-->
<Service name="Catalina"> #服务名是Catalina
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1" #连接器,端口8080,从这个端口接受用户请求
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define an SSL HTTP/1.1 Connector on port 8443
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
<Connector protocol="AJP/1.3" #与AJP协议相关
address="::1"
port="8009"
redirectPort="8443" />
-->
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost"> #引擎名称叫Catalina defaultHost默认主机
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm"> #这里是Realm,这里默认没有定义帐号密码,所以都可以访问 LockOutRealm????这个看不懂
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps" #这是host
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" #访问日志阀门,这里有路径directory(logs是相对于tomcat的安装路径)
prefix="localhost_access_log." suffix=".txt" #prefix前缀,suffix后缀,中间是日期或时间
pattern="%h %l %u %t "%r" %s %b" /> #pattern是日志格式
</Host>
</Engine>
</Service>
</Server>
启动tomcat
[root@master tomcat]# export CATALINA_HOME=/usr/local/tomcat/ #(未执行) #tomcat自身实例运行所在的目录,或工作路径,我们可以启动多个实例的,但需要使用不同的端口 使用CATALINA_HOME或CATALINA_BASE?????
CATALINA_HOME下的bin下的各种程序也得加入PATH
[root@master tomcat]# vim /etc/profile.d/tomcat.sh
export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:$CATALINA_HOME/bin
[root@master tomcat]# . /etc/profile.d/tomcat.sh
[root@master tomcat]#
[root@master tomcat]# ls bin/ #其它.sh的名称可当作参数传给catalina.sh
bootstrap.jar daemon.sh startup.sh
catalina.bat digest.bat tomcat-juli.jar
catalina.sh digest.sh tomcat-native.tar.gz
catalina-tasks.xml setclasspath.bat tool-wrapper.bat
commons-daemon.jar setclasspath.sh tool-wrapper.sh
commons-daemon-native.tar.gz shutdown.bat version.bat
configtest.bat shutdown.sh version.sh
configtest.sh startup.bat
[root@master tomcat]#
[root@master tomcat]# catalina.sh version #就是执行了 version.sh 建议是 catalina.sh version
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.6.0_21
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar #类加载时加载的类的路径????(是路径????)
Using CATALINA_OPTS:
Server version: Apache Tomcat/7.0.109
Server built: Apr 22 2021 18:43:38 UTC
Server number: 7.0.109.0
OS Name: Linux
OS Version: 2.6.32-754.el6.i686
Architecture: i386
JVM Version: 1.6.0_21-b06
JVM Vendor: Sun Microsystems Inc.
[root@master tomcat]#
[root@master tomcat]# version.sh #也一样
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.6.0_21
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin /tomcat-juli.jar
Using CATALINA_OPTS:
Server version: Apache Tomcat/7.0.109
Server built: Apr 22 2021 18:43:38 UTC
Server number: 7.0.109.0
OS Name: Linux
OS Version: 2.6.32-754.el6.i686
Architecture: i386
JVM Version: 1.6.0_21-b06
JVM Vendor: Sun Microsystems Inc.
[root@master tomcat]#
[root@master tomcat]# catalina.sh start #有startup.sh ,但是不必用catalina.sh startup,用 catalina.sh start 也可以
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.6.0_21
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@master tomcat]#
[root@master tomcat]# jps
3344 Jps
3322 Bootstrap #正在bootstrap
[root@master tomcat]# jps
3376 Jps
3322 Bootstrap
[root@master tomcat]# jps
3322 Bootstrap
3394 Jps
[root@master tomcat]#
[root@master tomcat]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:57711 0.0.0.0:* LISTEN 1793/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1771/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2130/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1849/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2467/master
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2106/php-fpm
tcp 0 0 :::3306 :::* LISTEN 2398/mysqld
tcp 0 0 :::111 :::* LISTEN 1771/rpcbind
tcp 0 0 :::8080 :::* LISTEN 3322/java #监听了 ,马哥那边还看到了8009,我这边在server.xml中没有开启8009吧
tcp 0 0 :::22 :::* LISTEN 2130/sshd
tcp 0 0 ::1:631 :::* LISTEN 1849/cupsd
tcp 0 0 ::1:25 :::* LISTEN 2467/master
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 3322/java
tcp 0 0 :::56838 :::* LISTEN 1793/rpc.statd
[root@master tomcat]#
[root@master tomcat]# ls
bin CONTRIBUTING.md logs RELEASE-NOTES webapps
BUILDING.txt lib NOTICE RUNNING.txt work
conf LICENSE README.md temp
[root@master tomcat]#
[root@master tomcat]# ls lib/ #库文件路径,一堆jar文件,是tomcat实施过程中的重要的类库
annotations-api.jar jsp-api.jar(有这个) tomcat-i18n-ja.jar
catalina-ant.jar servlet-api.jar(有这个) tomcat-i18n-ko.jar
catalina-ha.jar tomcat7-websocket.jar tomcat-i18n-ru.jar
catalina.jar tomcat-api.jar tomcat-i18n-zh-CN.jar
catalina-tribes.jar tomcat-coyote.jar tomcat-jdbc.jar
ecj-4.4.2.jar tomcat-dbcp.jar tomcat-util.jar
el-api.jar tomcat-i18n-de.jar websocket-api.jar
jasper-el.jar tomcat-i18n-es.jar
jasper.jar(有这个) tomcat-i18n-fr.jar
[root@master tomcat]#
[root@master tomcat]# ls logs/ #日志目录,服务器启动后开始有日志,,日志在每次重启或每天滚动(一般是按天)
catalina.2021-06-26.log localhost.2021-06-26.log
catalina.out(启动的时候,catalina自己的输出) localhost_access_log.2021-06-26.txt(访问日志)
host-manager.2021-06-26.log manager.2021-06-26.log(与主机管理器相关的,是tomcat的web管理界面吗????)
[root@master tomcat]#
[root@master tomcat]# cat logs/catalina.2021-06-26.log #catalina自己启动时产生的相关信息
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: Server.服务器版本: Apache Tomcat/7.0.109
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 服务器构建: Apr 22 2021 18:43:38 UTC
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 服务器版本号: 7.0.109.0
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 操作系统名称: Linux
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: OS.版本: 2.6.32-754.el6.i686
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 架构: i386
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: Java 环境变量: /usr/java/jdk1.6.0_21/jre
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: Java虚拟机版本: 1.6.0_21-b06
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM.供应商: Sun Microsystems Inc.
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: /usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: /usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djdk.tls.ephemeralDHKeySize=2048
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dignore.endorsed.dirs=
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dcatalina.base=/usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dcatalina.home=/usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djava.io.tmpdir=/usr/local/tomcat/temp
2021-6-26 10:23:37 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: 在java.library.path:[/usr/java/jdk1.6.0_21/jre/lib/i386/server:/usr/java/jdk1.6.0_21/jre/lib/i386:/usr/java/jdk1.6.0_21/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib]上找不到基于APR的Apache Tomcat本机库,该库允许在生产环境中获得最佳性能
2021-6-26 10:23:37 org.apache.coyote.AbstractProtocol init
信息: 初始化协议处理器 ["http-bio-8080"]
2021-6-26 10:23:37 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1417 ms
2021-6-26 10:23:37 org.apache.catalina.core.StandardService startInternal
信息: 正在启动服务[Catalina]
2021-6-26 10:23:37 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.109
2021-6-26 10:23:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/docs]
2021-6-26 10:23:38 org.apache.tomcat.websocket.server.WsSci onStartup
信息: JSR 356 WebSocket (Java WebSocket 1.1) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.
2021-6-26 10:24:39 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
警告: 使用[SHA1PRNG]创建会话ID生成的SecureRandom实例花费了[60,893]毫秒。
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/docs]的部署已在[61,261]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/manager]
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/manager]的部署已在[77]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/ROOT] #只给了ip,没有后面的路径,就是访问它吧,所以这是默认位置,,,相当于apache的默认主机
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/ROOT]的部署已在[52]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/host-manager]
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/host-manager]的部署已在[60]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/examples]
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/examples]的部署已在[166]毫秒内完成
2021-6-26 10:24:39 org.apache.coyote.AbstractProtocol start
信息: 开始协议处理句柄["http-bio-8080"]
2021-6-26 10:24:39 org.apache.catalina.startup.Catalina start
信息: Server startup in 61720 ms
[root@master tomcat]#
[root@master tomcat]# cat logs/catalina.out #当前正在使用的catalina的日志文件?????????
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: Server.服务器版本: Apache Tomcat/7.0.109
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 服务器构建: Apr 22 2021 18:43:38 UTC
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 服务器版本号: 7.0.109.0
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 操作系统名称: Linux
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: OS.版本: 2.6.32-754.el6.i686
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 架构: i386
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: Java 环境变量: /usr/java/jdk1.6.0_21/jre
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: Java虚拟机版本: 1.6.0_21-b06
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM.供应商: Sun Microsystems Inc.
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE: /usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME: /usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djdk.tls.ephemeralDHKeySize=2048
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dignore.endorsed.dirs=
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dcatalina.base=/usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Dcatalina.home=/usr/local/tomcat
2021-6-26 10:23:37 org.apache.catalina.startup.VersionLoggerListener log
信息: 命令行参数: -Djava.io.tmpdir=/usr/local/tomcat/temp
2021-6-26 10:23:37 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: 在java.library.path:[/usr/java/jdk1.6.0_21/jre/lib/i386/server:/usr/java/jdk1.6.0_21/jre/lib/i386:/usr/java/jdk1.6.0_21/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib]上找不到基于APR的Apache Tomcat本机库,该库允许在生产环境中获得最佳性能
2021-6-26 10:23:37 org.apache.coyote.AbstractProtocol init
信息: 初始化协议处理器 ["http-bio-8080"]
2021-6-26 10:23:37 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1417 ms
2021-6-26 10:23:37 org.apache.catalina.core.StandardService startInternal
信息: 正在启动服务[Catalina]
2021-6-26 10:23:37 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.109
2021-6-26 10:23:37 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/docs]
2021-6-26 10:23:38 org.apache.tomcat.websocket.server.WsSci onStartup
信息: JSR 356 WebSocket (Java WebSocket 1.1) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.
2021-6-26 10:24:39 org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
警告: 使用[SHA1PRNG]创建会话ID生成的SecureRandom实例花费了[60,893]毫秒。
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/docs]的部署已在[61,261]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/manager]
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/manager]的部署已在[77]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/ROOT]
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/ROOT]的部署已在[52]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/host-manager]
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/host-manager]的部署已在[60]毫秒内完成
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: 把web 应用程序部署到目录 [/usr/local/apache-tomcat-7.0.109/webapps/examples]
2021-6-26 10:24:39 org.apache.catalina.startup.HostConfig deployDirectory
信息: Web应用程序目录[/usr/local/apache-tomcat-7.0.109/webapps/examples]的部署已在[166]毫秒内完成
2021-6-26 10:24:39 org.apache.coyote.AbstractProtocol start
信息: 开始协议处理句柄["http-bio-8080"]
2021-6-26 10:24:39 org.apache.catalina.startup.Catalina start
信息: Server startup in 61720 ms
[root@master tomcat]#
[root@master tomcat]# ls logs/
catalina.2021-06-26.log localhost.2021-06-26.log(localhost应用程序的日志文件,,,,,在 conf/server.xml中定义了一个主机叫localhost)
catalina.out localhost_access_log.2021-06-26.txt(localhost应用程序的访问日志文件)
host-manager.2021-06-26.log(host-manager应用程序的日志文件) manager.2021-06-26.log(manager应用程序的日志文件)
[root@master tomcat]#
[root@master tomcat]# cat logs/localhost.2021-06-26.log #错误信息或与主机部署相关的信息???????,,包括上下文初始化等
2021-6-26 10:24:39 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2021-6-26 10:24:39 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2021-6-26 10:24:39 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@52d1a4')
2021-6-26 10:24:39 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@1304043')
[root@master tomcat]#
[root@master tomcat]# ls temp/ #临时文件目录
safeToDelete.tmp
[root@master tomcat]#
[root@master tomcat]# ls webapps/ #应用程序目录
docs examples host-manager manager ROOT
[root@master tomcat]#
[root@master tomcat]# ls webapps/ROOT/
##(WEB-INF,META-INF 里面放的是应用程序的私有资源,其它资源都可以通过web服务访问到的)
asf-logo-wide.svg bg-upper.png tomcat.css tomcat.svg
bg-button.png favicon.ico tomcat.gif WEB-INF
bg-middle.png index.jsp tomcat.png
bg-nav.png RELEASE-NOTES.txt tomcat-power.gif
[root@master tomcat]#
[root@master tomcat]# ls webapps/manager/
images index.jsp META-INF status.xsd WEB-INF xform.xsl
[root@master tomcat]#
[root@master tomcat]# ls webapps/manager/
images index.jsp META-INF status.xsd WEB-INF xform.xsl
[root@master tomcat]#
[root@master tomcat]# ls webapps/docs/
aio.html jdbc-pool.html
annotationapi jndi-datasource-examples-howto.html
api jndi-resources-howto.html
appdev jspapi
apr.html logging.html
architecture manager-howto.html
balancer-howto.html maven-jars.html
building.html mbeans-descriptors.dtd
BUILDING.txt mbeans-descriptors-howto.html
cgi-howto.html monitoring.html
changelog.html proxy-howto.html
class-loader-howto.html realm-howto.html
cluster-howto.html RELEASE-NOTES.txt
comments.html RUNNING.txt
config security-howto.html
connectors.html security-manager-howto.html
default-servlet.html servletapi
deployer-howto.html setup.html
developers.html ssi-howto.html
elapi ssl-howto.html
extras.html tribes
host-manager-howto.html virtual-hosting-howto.html
html-host-manager-howto.html WEB-INF
html-manager-howto.html websocketapi
images web-socket-howto.html
index.html windows-auth-howto.html
introduction.html windows-service-howto.html
jasper-howto.html
[root@master tomcat]#
[root@master tomcat]# ls webapps/ROOT/WEB-INF/
web.xml #应用程序的部署描述符文件
[root@master tomcat]#
WEB-INF 目录下可能有class(私有类)和lib(私有库)目录
[root@master tomcat]# ls work/ #工作目录,其目录下,每一个引擎都有自己独有的目录
Catalina
[root@master tomcat]#
[root@master tomcat]# ls work/Catalina/ #在每一个引擎目录下,每一个主机都有自己独有的目录
localhost
[root@master tomcat]#
[root@master tomcat]# ls work/Catalina/localhost/ #每一个主机的每一个应用程序都有自己的目录???
_ docs examples host-manager manager
[root@master tomcat]#
[root@master tomcat]# ls work/Catalina/localhost/manager/
[root@master tomcat]#
所有的.jsp,转换成.java,编译成.class work目录就是工作车间,所以访问页面后,转换成的.java,.class都在这里面
[root@master tomcat]# ls work/Catalina/localhost/_ #_这是root的,是根
[root@master tomcat]#
访问 http://192.168.0.60:8080/ 第一次访问慢
[root@master tomcat]# ls work/Catalina/localhost/_ #第一次访问后有内容
org
[root@master tomcat]#
[root@master tomcat]# ls work/Catalina/localhost/_/org/apache/jsp/
index_jsp.class index_jsp.java #第一次访问后生成的,,,所以第一个用户访问会慢一点
[root@master tomcat]#
[root@master tomcat]# jps
3610 Jps
3322 Bootstrap #tomcat是使用Bootstrap程序启动起来的,可以用java的一些命令监控3322这个进程
[root@master tomcat]#
# service tomcat XXXX 下面这个不支持 restart,因为没有写restart 下图 # ls bin 也没有看到restart
A Tomcat init script for Linux
#!/bin/sh
# Tomcat init script for Linux.
#
# chkconfig: 2345 96 14
# description: The Apache Tomcat servlet/JSP container.
CATALINA_HOME=/opt/apache-tomcat-7.0.29 #定义CATALINA_HOME位置
export CATALINA_HOME #导出CATALINA_HOME 还要导出 CATALINA的path路径吧
# export CATALINA_OPTS="-Xms128m -Xmx256m" #CATALINA工作时定义堆内存的最小值(最始值),最大值
exec $CATALINA_HOME/bin/catalina.sh $* # $* 是service tomcat 后面的参数
[root@master tomcat]# vim /etc/rc.d/init.d/tomcat
#!/bin/sh
# Tomcat init script for Linux.
#
# chkconfig: 2345 96 14
# description: The Apache Tomcat servlet/JSP container.
JAVA_HOME=/usr/java/latest #这里加个JAVA_HOME
CATALINA_HOME=/usr/local/tomcat
export JAVA_HOME CATALINA_HOME
# export CATALINA_OPTS="-Xms128m -Xmx256m"
exec $CATALINA_HOME/bin/catalina.sh $*
[root@master tomcat]# chmod +x /etc/rc.d/init.d/tomcat #加执行权限
[root@master tomcat]# chkconfig --add tomcat
[root@master tomcat]# chkconfig --list tomcat
tomcat 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@master tomcat]#
[root@master tomcat]# service tomcat stop #停掉
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
[root@master tomcat]#
[root@master tomcat]# service tomcat start #开启 因为是java程序,JVM整个的自己初始化是需要时间的,所以要慢点,等一下
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@master tomcat]#
自己可以加个在/etc/rc.d/init.d/tomcat 里面加个 restart ,,,,,,case判定一下,如果是restart ,stop一下,睡2秒,再start
[root@master tomcat]# catalina.sh --help
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.6.0_21
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin /tomcat-juli.jar
Using CATALINA_OPTS:
Usage: catalina.sh ( commands ... )
commands:
debug Start Catalina in a debugger #调试
debug -security Debug Catalina with a security manager
jpda start Start Catalina under JPDA debugger
run Start Catalina in the current window #启动后占据前台
run -security Start in the current window with security manager
start Start Catalina in a separate window #启动后不占前台
start -security Start in a separate window with security manager
stop Stop Catalina, waiting up to 5 seconds for the process to en d
stop n Stop Catalina, waiting up to n seconds for the process to en d #等几秒钟释放其它资源,再关闭,是优雅的关闭吧
stop -force Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running #强制 关闭
stop n -force Stop Catalina, wait up to n seconds and then use kill -KILL if still running
configtest Run a basic syntax check on server.xml - check exit code for result #测试配置文件
version What version of tomcat are you running? #看看版本号
Note: Waiting for the process to end and use of the -force option require that $ CATALINA_PID is defined
[root@master tomcat]#
[root@master tomcat]# service tomcat configtest #可看到错误,因为服务已经启动了,所以测试时会报错
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/7.0.109
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Apr 22 2021 18:43:38 UTC
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 7.0.109.0
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 2.6.32-754.el6.i686
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: i386
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /usr/java/jdk1.6.0_21/jre
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.6.0_21-b06
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Sun Microsystems Inc.
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /usr/local/tomcat
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /usr/local/tomcat
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dignore.endorsed.dirs=
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/usr/local/tomcat
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/local/tomcat
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
Jun 26, 2021 11:59:39 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/jdk1.6.0_21/jre/lib/i386/server:/usr/java/jdk1.6.0_21/jre/lib/i386:/usr/java/jdk1.6.0_21/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib]
Jun 26, 2021 11:59:39 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 26, 2021 11:59:39 AM org.apache.coyote.AbstractProtocol init
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use <null>:8080
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:414)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:750)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:467)
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1030)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:826)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
at org.apache.catalina.startup.Catalina.load(Catalina.java:686)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:244)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
Caused by: java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:141)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:401)
... 17 more
Jun 26, 2021 11:59:39 AM org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8080]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1032)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:826)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
at org.apache.catalina.startup.Catalina.load(Catalina.java:686)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:244)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
Caused by: java.net.BindException: Address already in use <null>:8080
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:414)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:750)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:467)
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1030)
... 13 more
Caused by: java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:141)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:401)
... 17 more
Jun 26, 2021 11:59:39 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 513 ms
[root@master tomcat]#
[root@master tomcat]# service tomcat stop #先关闭
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
[root@master tomcat]#
[root@master tomcat]# service tomcat configtest #此时不报错了
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin /tomcat-juli.jar
Using CATALINA_OPTS:
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/7.0.109
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Apr 22 2021 18:43:38 UTC
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 7.0.109.0
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 2.6.32-754.el6.i686
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: i386
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /usr/java/jdk1.6.0_21/jre
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.6.0_21-b06
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Sun Microsystems Inc.
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /usr/local/tomcat
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /usr/local/tomcat
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLo aderLogManager
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMA SK=0027
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dignore.endorsed.dirs=
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/usr/local/tomcat
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/local/tomcat
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
Jun 26, 2021 12:01:20 PM org.apache.catalina.core.AprLifecycleListener lifecycle Event
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/jdk1.6.0_21/jre/lib/i386/server:/usr/java/j dk1.6.0_21/jre/lib/i386:/usr/java/jdk1.6.0_21/jre/../lib/i386:/usr/java/packages /lib/i386:/lib:/usr/lib]
Jun 26, 2021 12:01:20 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 26, 2021 12:01:20 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 512 ms
[root@master tomcat]#
[root@master tomcat]# service tomcat start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/latest
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.
[root@master tomcat]#
配置文件的修改 conf目录下
[root@master tomcat]# pwd
/usr/local/tomcat
[root@master tomcat]#
[root@master tomcat]# ls conf/
Catalina context.xml tomcat-users.xml
catalina.policy logging.properties tomcat-users.xsd
catalina.properties server.xml web.xml
[root@master tomcat]#