roller4.0 安裝小記
roller4.0 安裝總體感覺很方便。有安裝向導頁面,自動建立數據庫表。
但也有一點小問題,install-guide 上沒有寫得太詳細,也可能我看得不夠仔細,呵呵
。一個是沒有說配置連接池配置文件,另一個是中文有點問題。
總結如下:
安裝環境:
JDK 1.5.05
tomcat-5.5.17
mysql-5.0.27
apache-roller-4.0
安裝使用的是 msyql 數據庫,現建立數據庫和用戶
mysql> create database rollerdb default charset utf8 collate utf8_general_ci;
文檔install-guide 上 create database rollerdb ; 建立的數據庫默認是 lat1 字符
編碼,中文會有問題所以使用 utf8 編碼
給用戶授權
mysql> grant all on rollerdb.* to scott@'%' identified by 'tiger';
mysql> grant all on rollerdb.* to scott@localhost identified by 'tiger';
mysql> create database rollerdb default charset utf8 collate utf8_general_ci;
文檔install-guide 上 create database rollerdb ; 建立的數據庫默認是 lat1 字符
編碼,中文會有問題所以使用 utf8 編碼
給用戶授權
mysql> grant all on rollerdb.* to scott@'%' identified by 'tiger';
mysql> grant all on rollerdb.* to scott@localhost identified by 'tiger';
為了使用java mail 發送郵件,tomcat 的 common/lib 文件夾中放入 activation.jar,
javamail.jar
困了,先睡了回頭再寫...
各位新年快樂!
在 conf/server.xml 文件中的connector加入 URIEncoding=”UTF-8”, 為了I18N
例如:
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" debug="0"
acceptCount="100" connectionTimeout="20000"
disableUploadTimeout="true"
URIEncoding="UTF-8" />
將roller 發行包的 roller 文件夾copy 到tomcat 的 webapps 下。
關于JDBC 驅動 install-guiade 上說
For MySQL 4.1.x 使用 the J/Connector 3.0.X JDBC
For MySQL 5.X use the J/Connector 3.1.X JDBC drivers
拷貝到 tomcat/common/lib 下
建立一個 roller-custom.properties 文件內容如下:
installation.type=auto
database.configurationType=jdbc
database.jdbc.driverClass=com.mysql.jdbc.Driver
database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8
database.jdbc.username=scott
database.jdbc.password=tiger
mail.configurationType=properties
mail.hostname=smtp-server.example.com
mail.username=scott
mail.password=tiger
roller-custom.properties 放到 tomcat/common/classes 下
(這里有一個問題我不大明白,在roller-custom.properties
文件里指定了數據庫連接,但是還需要制定一個數據庫的連接池
給roller 才能正常工作,而且注意 database.jdbc.connectionURL=jdbc:mysql://localhost:3306/
rollerdb?autoReconnect=true&useUnicode
=true&characterEncoding=utf-8&mysqlEncoding=utf8
屬性,如果按install-guide 的 database.jdbc.connectionURL=jdbc:mysql://localhost:3306/
rollerdb 中文是會亂碼的)
在\tomcat-5.5.17\conf\Catalina\localhost放入一個 roller.xml
文件,內容如下:
Java代碼
<Context path="/roller"
docBase="roller" debug="0">
<Resource name="jdbc/rollerdb" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8"
username="root"
password="mysql"
maxActive="20"
maxIdle="3"
removeAbandoned="true"
maxWait="3000" />
<!-- If you want e-mail features, un-comment the section below -->
<!--
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"
mail.smtp.host="mailhost.example.com" />
-->
</Context>
<Context path="/roller"
docBase="roller" debug="0">
<Resource name="jdbc/rollerdb" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8"
username="root"
password="mysql"
maxActive="20"
maxIdle="3"
removeAbandoned="true"
maxWait="3000" />
<!-- If you want e-mail features, un-comment the section below -->
<!--
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"
mail.smtp.host="mailhost.example.com" />
-->
</Context>
其實就是指定了一個 jdbc/rollerdb 的 jndi datasource,
如果沒有的話,會發現每次見了用戶,登陸時就登陸不了。提示
密碼或用戶錯,但是用戶確實在數據庫表中了,我覺得
roller-custom.properties
和roller.xml 中的數據源配置都用到了,有點奇怪。
回頭看看源碼可能就知道是怎么回事了。
啟動tomcat ,就可以正常安裝roller 了