1.下载jetty服务器(8.1.0.RC2),解压到任意目录下
http://dist.codehaus.org/jetty/jetty-hightide-8.1.0/jetty-hightide-8.1.0.RC2.zip
2.新建jetty-dataSource.xml文件,放在${JETTY_HOME}\contexts目录下
这个例子新建了两个mysql数据源,
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- ==================================================================
Configure and deploy the test web application in $(jetty.home)/webapps/test
Note. If this file did not exist or used a context path other that /test
then the default configuration of jetty.xml would discover the test
webapplication with a WebAppDeployer. By specifying a context in this
directory, additional configuration may be specified and hot deployments
detected.
===================================================================== -->
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/datasource</Set>
<Set name="resourceBase">./</Set>
<New id="showcase" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/showcase</Arg>
<Arg>
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
<Set name="driverClass">com.mysql.jdbc.Driver</Set>
<Set name="jdbcUrl">jdbc:mysql://localhost:3306/showcase?useUnicode=true&characterEncoding=UTF8</Set>
<Set name="user">root</Set>
<Set name="password">111111</Set>
</New>
</Arg>
</New>
<New id="quartz" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/quartz</Arg>
<Arg>
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
<Set name="driverClass">com.mysql.jdbc.Driver</Set>
<Set name="jdbcUrl">jdbc:mysql://localhost:3306/quartz?useUnicode=true&characterEncoding=UTF8</Set>
<Set name="user">root</Set>
<Set name="password">111111</Set>
</New>
</Arg>
</New>
</Configure>
3.将数据源用到的jar包放到${JETTY_HOME}\lib\ext目录下
因为以上用到了c3p0数据库连接池和mysql数据库,因此需要将mysql-connector-java-5.1.17.jar和c3p0-0.9.1.2.jar放到jetty容器的lib中
4.重启jetty容器
命令行到${JETTY_HOME}目录下,运行 java -jar start.jar启动容器
5.附:常见的jndi数据库链接池配置
参考:http://wiki.eclipse.org/Jetty/Howto/Configure_JNDI_Datasource
分享到:
相关推荐
NULL 博文链接:https://seraph115.iteye.com/blog/436300
Jetty配置支持HTTPS以及受信网站证书生成方式
Jetty9 配置使用HTTPS证书,访问你的服务器更安全,更好的配置方法。
自己写的jetty6在eclipse启动中配置说明
tomcat 配置工程 数据源
简单jetty配置
java运行依赖jar包
java运行依赖jar包
Java Eclipse ee集合jetty和配置
jar包版本9.4.8.v20171121,包含jetty-server-9.4.8.v20171121.jar,jetty-servlet-9.4.8.v20171121.jar,...jetty-annotations-9.4.8.v20171121.jarjetty-deploy-9.4.8.v20171121.jar,jetty-jndi-9.4.8.v20171121.jar
Jetty 配置 SSL 如何在jetty下配置SSL
JETTY启动文件配置方法.txt
网上看到jetty-proxy有反相代理功能,根据很多网页配置并未成功,感觉是jetty版本更新比较快,文档跟不上,所以把我调试通过的上传一下。jetty版本9.4.6
jetty启动配置文件
( apache+jetty负载配置案例.zip ) 亲测可用,文档+APACHE原文件,稍做修改即可直接使用,可隐藏后端真实服务器地址,加上域名则更完美!!! 有需要的朋友自行下载使用。
Eclipse_Maven_Jetty配置
在JNDI中配置数据源(DataSource) 内嵌Jetty服务器 内嵌Jetty教程 内嵌Jetty的HelloWorld教程 内嵌Jetty视频 优化Jetty 如何配置垃圾收集 如何配置以支持高负载 在Jetty中部署应用 部署管理器 部署绑定 热部署 ...
jetty源代码下载 jetty源代码下载 jetty源代码下载 jetty源代码下载
maven jetty插件配置指南。 看看就知道。
jetty-jndi-9.2.26.v20180806.jar jetty-plus-9.2.26.v20180806.jar jetty-proxy-9.2.26.v20180806.jar jetty-quickstart-9.2.26.v20180806.jar jetty-rewrite-9.2.26.v20180806.jar jetty-schemas-3.1.jar。。。。