1 安装Virgo tomcat server
下载
解压缩到D:\virgo-tomcat-server-3.5.0.RELEASE下,运行其下bin\startup.bat可以启动服务器。
2 安装Apache Marven
3 Greenpages简介
GreenPages is a simple application that allows users to search an online email address directory. Each listing in the directory details the relevant email addresses and the name of the owner. GreenPages has only three screens: the search screen, the results screen and the listing detail screen.
In the search screen, users can enter search criteria to be matched against the listings in the directory. The result screen displays any listings that match the criteria entered by the user. The listing detail screen shows all the data known about a given listing.
Despite its simplicity, GreenPages is designed to demonstrate many different Virgo Tomcat Server features and to act as a template from which other modular applications can be built. In particular, GreenPages demonstrates:
-
bundle dependencies with
Import-Package
, -
load-time weaving with JPA and AspectJ,
-
bundle classpath scanning, and
-
service export, lookup and injection.
In addition to demonstrating common Virgo Tomcat Server features, GreenPages demonstrates integration with:
-
Spring Framework 3.0;
-
FreeMarker 2.3;
-
EclipseLink 1.0.0;
-
H2 1.0.71; and
-
Commons DBCP 1.2.2.
The GreenPages application is packaged as a PAR file containing four bundles.
![]() |
The greenpages.db
bundle provides access to an external database and publishes a javax.sql.DataSource
service.
The greenpages.app
bundle exports a greenpages
package containing Directory
and Listing
interfaces.
The greenpages.jpa
bundle imports the greenpages
package and uses the javax.sql.DataSource
service to access the external database and publishes its contents as a greenpages.Directory
service.
The greenpages.web
web application bundle imports the greenpages
package and uses the greenpages.Directory
service to respond to web requests.
4 安装Greenpages
下载Greenpages最新版,2.5版;解压缩后文件夹结构如:
d:\greenpages-2.5.0.RELEASE\db,....
5 编译
进入DOS命令符
d:\greenpages-2.5.0.RELEASE>mvn package
大约花费6分多钟,出现所有项目Success后,
在d:\greenpages-2.5.0.RELEASE\greenpages会出现target文件夹。
6 数据库参数设置
d:\greenpages-2.5.0.RELEASE> cd db
d:\greenpages-2.5.0.RELEASE\db> run
浏览器出现参数设置窗口,用默认值,关闭该窗口
d:\greenpages-2.5.0.RELEASE\db> data
7 部署
拷贝d:\greenpages-2.5.0.RELEASE\greenpages\target\greenpages-2.5.0.RELEASE.par文件到D:\virgo-tomcat-server-3.5.0.RELEASE\pickup下。
8 测试
Dos下进入D:\virgo-tomcat-server-3.5.0.RELEASE\bin下,运行命令startup -clean
在浏览器中,访问http://localhost:8080/greenpages/app/home.htm
输入参数on,查询看结果。
运行正常
疑问:数据库参数设置后,其连接参数及创建的数据难道写入.par文件中了?否则,为什么拷贝.par文件后数据已存在于数据库中了?