快捷搜索:  汽车  科技

mysql在javafx中怎么运用?皕杰报表在tomcat的server.xml中配置了什么

mysql在javafx中怎么运用?皕杰报表在tomcat的server.xml中配置了什么<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />用于避免JRE内存泄漏问题<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />加载(服务器启动) 和 销毁 (服务器停止) APR。 如果找不到APR库, 则会输出日志, 并不影响Tomcat启动。​ shutdown:通过指定的端口(port)关闭Tomcat所需的字符串。2、 五个Listene,用来监听特定的事件<Listener className="org.apache.catalina.startup.VersionL

server.xml位于tomcat/conf目录下,是tomcat 服务器的核心配置文件。皕杰报表在用tomcat做中间件时,只需在server里配置项目数据源,其它配置无需改变。

下面就简单介绍一下皕杰版本在server.xml里的有关配置。

1、关闭tomcat命令端口及关闭命令

<Server port="8005" shutdown="SHUTDOWN">

port:Tomcat监听shutdown命令的端口。

​ shutdown:通过指定的端口(port)关闭Tomcat所需的字符串。

2、 五个Listene,用来监听特定的事件

<Listener className="org.apache.catalina.startup.VersionLoggerListener" />

监听以日志形式输出服务器 、操作系统、JVM的版本信息

<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

加载(服务器启动) 和 销毁 (服务器停止) APR。 如果找不到APR库, 则会输出日志, 并不影响Tomcat启动。

<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />

用于避免JRE内存泄漏问题

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

用户加载(服务器启动) 和 销毁(服务器停止) 全局命名服务

<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

用于在Context停止时重建Executor 池中的线程, 以避免ThreadLocal 相关的内存泄漏。

3、 全局资源的定义

<GlobalNamingResources> <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>

GlobalNamingResources元素定义了全局资源,通过配置可以看出,该配置是通过读取tomcat/ conf/tomcat-users.xml实现的。

4. Service服务

Service包含Executor、Connector、Engine,构成一个完整的服务。

1)、Executor 用于配置Service 共享线程池,指定共享线程池的名称,也可以通过maxThreads、minSpareThreads、maxIdleTime 等属性配置内部线程池。

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="800" minSpareThreads="50" maxIdleTime="10000"/>

2)、Connector 用于配置Service 包含的链接器。默认情况下,server.xml 配置了两个链接器,一个支持HTTP协议,一个支持AJP协议。因此大多数情况下,不需要新增链接器配置,只是根据需要对已有链接器进行优化。

<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" connectionTimeout="10000" redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true" enableLookups="false" executor="tomcatThreadPool" compression="on" compressionMinSize="2048" maxHttpHeaderSize="32768" compressableMimeType="text/html text/xml text/css text/plain text/javascript" />

3)、Engine 用于配置Service中链接器对应的Servlet 容器引擎。容器的功能是处理Connector接收进来的请求,并产生相应的响应。Engine、Host和Context都是容器,是父子关系:Engine包含Host,Host包含Context。一个Engine组件可以处理Service中的所有请求,一个Host组件可以处理发向一个特定虚拟主机的所有请求,一个Context组件可以处理一个特定Web应用的所有请求。

<Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="/iface" docBase="iface" reloadable="false"> <Resource name="MYSQL" auth="Container" type="javax.sql.DataSource" username="root" password="123" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1:3306/test1" maxActive="50" maxIdle="5" maxWait="3000" /> </Context> </Host> </Engine>

a)、 子容器Host,管理一个或多个Web项目

其中:

​ name:Host的名字

​ appBase:存放Web项目的目录(绝对路径、相对路径均可)

​ unpackWARs:当appBase下有WAR格式的项目时,是否将其解压(解成目录结构的Web项目)。设成false,则直接从WAR文件运行Web项目

​ autoDeploy:是否开启自动部署。设为true,Tomcat检测到appBase有新添加的Web项目时,会自动将其部署

​ 孙容器Context

​ Context代表一个运行在Host上的Web项目。一个Host上可以有多个Context。将一个Web项目添加到Tomcat,在Host标签内,添加Context标签

其中:

path:该Web项目的URL入口。path设置为””,输入***localhost:8080即可访问MyApp;path设置为”/test/MyApp”,输入***localhost:8080/test/MyApp才能访问MyApp

​ docBase:Web项目的路径,绝对路径、相对路径均可(相对路径是相对于CATALINA_HOME\webapps)

reloadable:设置为true,Tomcat会自动监控Web项目的/WEB-INF/classes/和/WEB-INF/lib变化,当检测到变化时,会重新部署Web项目。reloadable默认值为false。通常项目开发过程中设为true,项目发布的则设为false

crossContext:设置为true,该Web项目的Session信息可以共享给同一host下的其他Web项目。默认为false

b)、Realm

Realm可以理解为包含用户、密码、角色的”数据库”。Tomcat定义了多种Realm实现:JDBC Database Realm、DataSource Database Realm、JNDI Directory Realm、UserDatabase Realm等。

mysql在javafx中怎么运用?皕杰报表在tomcat的server.xml中配置了什么(1)

猜您喜欢: