1. Download mysql jdbc jar file into jetty-home/lib/jndi
2. Configure webapp's context xml in jetty-home/contexts
2.1 Add configuration like bellow
3. Configure web.xml of the webapp<New id="test1" class="org.eclipse.jetty.plus.jndi.Resource"><Arg></Arg><Arg>jdbc/test1</Arg><Arg><New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"><Set name="Url">jdbc:mysql://localhost:3306/test1</Set><Set name="User">test1</Set><Set name="Password">test1</Set></New></Arg></New>
3.1 Add configuration like bellow
<resource-ref><description>DB Connection</description><res-ref-name>jdbc/test1</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth></resource-ref>
Log4J
1. Download log4j jar file into jetty-home/lib/ext
2. Use "java-jar start.jar OPTIONS=Server,ext" to start jetty. Jetty will load all jar files in jetty-home/lib/ext
沒有留言:
張貼留言