近一年都要和seam打交道了,所以环境肯定要搭建的,显示下载seam框架,再是装jboss服务器,又下ant,按照reference的帮助文档来讲,这些再加上配置好的jdk环境的话就可以跑出seam中自带n多个例子的。启动jboss,ant seam-examples, 运行localhost,可是就是404啊,说明项目没有部署到jboss server中,随即打开server/deploy,的确没有xxx.ear,但明明提示的是build successf的,查看了下ant日志原来是没有copy到服务器中去,说白了工程的部署不就是把ear包copy到jboss服务器的deploy中,可就是完不成到服务器的部署,经过好长时间的排查,最终确定是路径的问题,设置build.properties中的jboss.home 时C:\\jboss-4.2.3.GA的路径斜杠在windows中必须是两个,否则就找不到服务器。
整个过程中所需要的软件如下:
ant1.8.2
jdk5.0以上版本
jboss as 4.2
jboss seam 2.2.0
1:先配置jboss seam根目录下build.properties ,在最末一行添加一行:jboss.home c:\\jboss根目录
2:启动jboss
3:部署booking这个例子,首先用cmd进入\booking 这个路径下面,直接ant deploy 结束后console会有提示,然后去jboss的\server\default\deploy 目录下面看看是否已经部署成功,如果部署成功,会有jboss-seam-booking.ear,jboss-seam-booking-ds.xml 这2个文件生成
4:修改jboss-seam-booking-ds.xml
PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
|
修改完后你可以去你的hsqldb下面去找生成的数据,jboss自己带一个tool 可以查看数据,这个tool是个awt程序,在jboss console 里面——》
jboss
database=localDB,service=Hypersonic——》
void startDatabaseManager()
MBean Operation.
点击invoke就可以启动这个tool, file ——》connect ——>URL 更改为jdbc:hsqldb:yourdb 就可以查看到delopoy后自动建的表,以及初始化数据!
运行http://localhost:8080/seam-booking/就可以跑这个example了
最后总结一下,如果把seam所有的example搞清楚,你就基本搞清楚seam 的几乎所有内容,因为example牵扯了几乎所有seam的feature:
这是seam example 里面的内容
blog/ The Seam blog example, showing how to write booking/ The Seam Booking demo application for EJB 3.0 contactlist/ The Seam Contact List demo demonstrating use dvdstore/ The Seam DVD Store demo demonstrating jBPM hibernate/ The Seam Booking demo ported to Hibernate3 icefaces/ The Seam Booking demo with ICEfaces, instead of itext/ A demo of the Seam iText integration for generating pdfs jpa/ An example of the use of JPA (provided by Hibernate), runs messages/ The Seam message list example demonstrating use numberguess/ The Seam number guessing example, demonstrating quartz/ A port of the Seampay example to use the Quartz dispatcher registration/ A trivial example for the tutorial remoting/chatroom/ The Seam Chat Room example, demostrating Seam remoting/gwt/ An example of using GWT with Seam remoting remoting/helloworld/ A trivial example using Ajax seambay/ An example of using Seam with Web Services seamdiscs/ Demonstrates Seam, Trinidad, Ajax4jsf and Richfaces seampay/ The Seam Payments demo demonstrating the use of spring/ Demonstrates Spring framework integration todo/ The Seam todo list example demonstrating wiki/ A fully featured wiki system based on Seam, please |