Jetspeed JetExpress Tutorial Portal筆記1
-- 定制portal安裝
0. 約定
目錄分隔符使用’/'等同于’\',文中僅使用’/’
1. 資源
2. 工作環(huán)境配置(初始化)
注1 : /JetspeedTraining/database/jetexpress目錄不能預(yù)先創(chuàng)建,只能創(chuàng)建/JetspeedTraining/database目錄,否則3.2步時(shí)會(huì)出現(xiàn)數(shù)據(jù)庫(kù)無(wú)法創(chuàng)建的錯(cuò)誤。
建好以后目錄結(jié)構(gòu)如下:
C:/JETSPEEDTRAINING
├─database
│ └─jetexpress
├─maven
│ └─repository
│ ├─ant
…
│ └─xml-apis
├─resources
│ ├─applications
…
│ └─seed-data
├─tomcat-express
│ ├─bin
…
│ ├─temp
│ ├─webapps
│ └─work
└─workspace
…處表示省略了若干目錄
3. 開(kāi)始Tutorial
3.1 創(chuàng)建jetexpress工程(a new custom portal named jetexpress)
cd /JetspeedTraining/workspace
mvn archetype:create -DarchetypeGroupId=org.apache.portals.jetspeed-2
-DarchetypeArtifactId=portal-archetype
-DarchetypeVersion=2.1-dev
-DgroupId=org.apache.portals.tutorials
-DartifactId=jetexpress
-Dversion=1.0
3.2 編譯創(chuàng)建的portal工程 (build the portal)
cd /JetspeedTraining/workspace/jetexpress
mvn -P tomcat,min
3.2 運(yùn)行自定義Jetspeed Portal
這里本文使用的tomcat是作者另外安裝的,沒(méi)有原文提到的catdebug,啟動(dòng)方式略有不同
cd tomcat-express
cd bin
startup.bat
3.3 訪問(wèn)http://localhost:8080/jetexpress/portal/
4 操作過(guò)程中遇到的問(wèn)題及解決辦法(FAQ:常見(jiàn)問(wèn)題列表)
4.1. Jetspeed Tutorial文中提到的目錄到哪里找
見(jiàn)本文第2節(jié)
4.2. Tomcat需要如何配置
修改”%USERPROFILE%/.m2/settings.xml中的tomcat目錄到指定目錄,或拷貝tomcat
到/JetspeedTraining/tomcat-express目錄,
修改/JetspeedTraining/tomcat-express/conf/tomcat-users.xml文件如下(全部?jī)?nèi)容):
<?xml version=”1.0″ encoding=”UTF-8″?>
<tomcat-users>
<user name=”tomcat” password=”tomcat” roles=”tomcat” />
<user username=”j2deployer” password=”j2deployer” roles=”admin,manager,tomcat”/>
</tomcat-users>
4.3. 使用默認(rèn)數(shù)據(jù)庫(kù)配置,似乎編譯過(guò)程都正常,啟動(dòng)tomcat后,訪問(wèn)時(shí)報(bào)以下異常
org.apache.jetspeed.pipeline.PipelineException: Falied to create capabilitied: We were
unable to build a capability map for the agent, Mozilla/4.0. This might be an indiciation
that the capability database has not been correctly initialized.
看異常信息,知道是數(shù)據(jù)庫(kù)初始化失敗,但是由于對(duì)Derby數(shù)據(jù)庫(kù)不熟,無(wú)法查找具體原因,只能選擇換
到mysql上,步驟如下:
4.3.1 安裝mysql數(shù)據(jù)庫(kù)
創(chuàng)建用戶jetexpress,密碼jetexpress
創(chuàng)建數(shù)據(jù)庫(kù)jetexpress
create database jetexpress;
4.3.2 準(zhǔn)備mysql驅(qū)動(dòng)
放到c:/JetspeedTraining/mysql-connector-java-5.0.3-bin.jar
這里作者用的是5.0.3版本的驅(qū)動(dòng),路徑與下面的配置文件統(tǒng)一即可,無(wú)特殊要求
拷貝到C:/JetspeedTraining/tomcat-express/shared/lib下面一份
這里maven -P tomcat,min的時(shí)候不會(huì)拷貝這個(gè)驅(qū)動(dòng)文件,所以需要手動(dòng)加,加在
具體項(xiàng)目的lib下面也可以,這里放在tomcat下面,防止clean時(shí)刪掉
4.3.3 修改”%USERPROFILE%/.m2/settings.xml”數(shù)據(jù)庫(kù)部分
<org.apache.jetspeed.production.jdbc.drivers.path>c:/JetspeedTraining/mysql-connector-
java-5.0.3-bin.jar</org.apache.jetspeed.production.jdbc.drivers.path>
<org.apache.jetspeed.production.database.default.name>mysql</org.apache.jetspeed.production.
database.default.name>
<org.apache.jetspeed.production.database.url>jdbc:mysql://localhost:3306/jetexpress</org.apa
che.jetspeed.production.database.url>
<org.apache.jetspeed.production.database.driver>com.mysql.jdbc.Driver</org.apache.jetspeed.p
roduction.database.driver>
<org.apache.jetspeed.production.database.user>jetexpress</org.apache.jetspeed.production.dat
abase.user>
<org.apache.jetspeed.production.database.password>jetexpress</org.apache.jetspeed.production
.database.password>
4.3.4 清理一下
刪除tomcat/webapps目錄下的所有目錄及文件
刪除tomcat/work目錄下的所有目錄及文件
mvn clean
4.3.5 重新編譯,啟動(dòng)tomcat
mvn -P tomcat,min
startup.bat
終于看到可以的jetspeed portal了!
5. 總結(jié)
第4部分遇到的問(wèn)題在Google搜索答案的時(shí)候,基本上每個(gè)問(wèn)題都有人在問(wèn),但是都沒(méi)有準(zhǔn)確答案,所以都是作者自己摸索出來(lái)的,尤其是最后一個(gè),回答該問(wèn)題的是Jetspeed Tutorial 的作者,只是提醒發(fā)問(wèn)的人注意錯(cuò)誤信息是“數(shù)據(jù)庫(kù)初始化錯(cuò)誤(Looks like the database isn’t initialized. )”,不過(guò)這個(gè)提醒還是比較有價(jià)值的,我的反應(yīng)就是直接換了Mysql數(shù)據(jù)庫(kù)。Tutorial 作者在回答另外一個(gè)詢問(wèn)關(guān)于tomcat目錄問(wèn)題時(shí)如是說(shuō):
“this is just a tutorial and the least amount of parameters during
training the less mistakes trainees can make…. “
“Again as I stated on other threads on this list, I am rewriting the
tutorial to make it easier to install and learn with ”
所以現(xiàn)在這份Tutorial ,有好多處看不明白前因后果,也就忍了吧,呵呵,另外,自己研究得到答案的過(guò)程其實(shí)是最好的學(xué)習(xí)過(guò)程。
聯(lián)系客服