Thursday, May 26, 2005
Wednesday, May 25, 2005
Bookmark Online
Tuesday, May 24, 2005
Growl
Thursday, May 19, 2005
Tuesday, May 17, 2005
Setup JDBC DataSources under Tomcat
- server.xml before </host>
<Context path="/cpg" docBase="cpg" debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/bioDB" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/bioDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>30000</value>
</parameter>
<parameter>
<name>username</name>
<value>UHN</value>
</parameter>
<parameter>
<name>password</name>
<value>microarray</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/test</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>
</Context>
- web.xml
<description>DB Connection</description>
<res-ref-name>jdbc/bioDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
- test code
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc/bioDB">
select id, cont from aainno;
</sql:query>
<html>
<head>
<title>DB Test</title>
</head>
<body>
<h2>Results</h2>
<c:forEach var="row" items="${rs.rows}">
Foo ${row.id}<br/>
Bar ${row.cont}<br/>
</c:forEach>
</body>
</html>
- servlet
import javax.naming.InitialContext;
import javax.sql.DataSource;
Context env = new InitialContext();
DataSource pool = (DataSource) env.lookup("java:comp/env/jdbc/bioDB");
Connection database = pool.getConnection();
- Global Resources
Friday, May 13, 2005
mod_jk installation from source code under Mac OS X
cd apache-2.0
make -f Makefile.apxs
make -f Makefile.apxs install
cp workers.properties from jk/conf directory to apache/conf directory and make modification
make modification
add to http.conf
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send servlet for context /examples to worker named worker1
JkMount /*/servlet/* ajp13
# Send JSPs for context /examples to worker named worker1
JkMount /*.jsp ajp13
Wednesday, May 11, 2005
5 Simple Steps to Integrate Tomcat 5.5 with Apache 2.0
The simplest configuration is described. It assumes you already have Tomcat 5.5 and Apache 2.0 (instructions for Apache 1.3 is also provided) installed and running.
The instructions are applicable (have been tested) for Windows as well as Linux platform.
Assume you want to map test directory of Apache to the mytest web application of Tomcat. Change the name appropriately to suit your configuration.
1. Shutdown Apache & Tomcat Server
2. Add the following lines to httpd.conf (in conf directory of Apache base directory)
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyPass /test/ http://localhost:8081/mytest/
ProxyPassReverse /test/ http://localhost:8081/mytest/
Note: Replace localhost with the appropriate IP address or hostname of the server where Tomcat is installed.
Note 2: On older Apache 1.3 you will have to use libproxy.so instead:
I copied this article from http://blog.taragana.com/index.php/archive/5-steps-to-integrate-tomcat-55-with-apache-20/, but I have not tried it yet.LoadModule proxy_module modules/libproxy.so
AddModule mod_proxy.c
