linux 中tomcat8特性和tomcat项目发布事项

1,war启动即可用

每次启动tomcat之前发布的文件夹会自动删除,再一次从war解压

 tomcat  war发布就会自动覆盖原来解压后的文件夹,没有war直接用文件夹

2,直接文件夹也可

可以server.xml配置可以不配置(指定发布目录),最多配置catalina.sh内存

//处理head中的session信息过多size过大

<Connector port="8080" maxHttpHeaderSize="102400" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

<Host name="localhost"  appBase="webapps"

            unpackWARs="true" autoDeploy="true">

//这个是配置发布在tomcat,root下(不写绝对地址以appbase为父目录),否则写绝对地址,尤其在ngnix负载的时候,由于upstream只能配置ip+端口,不能写项目名称,所以tomcat发布的时候就只能发布到root下

// <Context path="项目访问名称" docBase="项目文件地址(war包解压后的)" debug="0" reloadable="true"/>

       <Context path="" docBase="hb_telesale" debug="0" reloadable="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"

               prefix="localhost_access_log." suffix=".txt"

               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>

3,部署的时候Tomcat可以指定jdk(默认使用操作系统选择运行的,通过linux系统文件配置jdk环境变量,然后重启系统配置文件即可)

4,tomcat8一旦有错就报内存泄漏是由于,这是他处理错误的机制,详细信息看dump,或项目日志,看到底是那段代码错了

ication was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

24-Aug-2017 21:48:45.633 WARNING [localhost-startStop-1]                   

[hb_telesale] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

 java.lang.Object.wait(Native Method)

 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)

 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)

One or more listeners failed to start. Full details will be found in the appropriate container log file

日志信息(越难解决的问题越重要)(不要遗漏有价值信息)

1,dump

2,log文件  /bin下(配置了log就在log看,结合控制台,信息记录分流)

3,jstack

1,定时任务

2,/etc/hosts  127映射 root

3,ip地址获取

参看:

https://my.oschina.net/feichexia/blog/196575

5,用什么版本的jdk编译的代码,服务器就要用对应版本的jdk,tomcat到可以不同

6,tomcat用哪个版本的jdk取决于你全局配置的环境变量(/etc/profiel中,配好后要重启)

7,Could not find or load main class org.apache.catalina.startup.Bootstrap

相关推荐