Tutorial for building J2EE Applications using JBOSS and ECLIPSE Chapter 3

在阅读这一章的时候,基本没有什么障碍,但是有一个地方文章是写错了。

Create DAO Interface  那一节中“Go to src > add package named au.com.tusc.dao > Add a class StoreAcessDAOImpl in that package”红色字体错了,应该是StoreAccessDAOImpl。

还有就是因为使用不同版本的jboss和lomboz,所以文章中说到的ejbGenerate.xml 文件对应的是xdoclet.xml文件。

Stateless Session Bean

根据Mastering EJB 2nd的描述,建立一个EJB Component所需要的几个步骤

1. Write the .java files that compose your bean: the component interfaces,
home interfaces, enterprise bean class file, and any helper classes you
might need.这一步因为有lomboz的帮忙,我只需要写enterprise bean class文件,在这一章的例子当中就是StoreAccessBean就是enterprise bean文件。然后在这个文件的开始地方加几个tag,如@ejb.dao,lomboz就会自动生成StoreAccessDAO文件。

2. Write the deployment descriptor. Lomboz会自动创建相关的部署文件


3. Compile the .java files from step 1 into .class files.Writing Your First Bean


4. Using the jar utility, create an Ejb-jar file containing the deploymentdescriptor and .class files.


5. Deploy the Ejb-jar file into your container in a vendor-specific manner,perhaps by running a vendor-specific tool or perhaps by copying yourEjb-jar file into a folder where your container looks to load Ejb-jar files.


6. Configure your EJB server so that it is properly configured to host yourEjb-jar file. You might tune things such as database connections, thread pools, and so on. This step is vendor-specific and might be done through a
Web-based console or by editing a configuration file.


7. Start your EJB container and confirm that it has loaded your Ejb-jar file.


8. Optionally, write a standalone test client .java file. Compile that test client into a .class file. Run the test client from the command line and have it exercise your bean’s APIs.

3~8步lomboz会自动帮我完成。看来有了Lomboz真的可以把精力集中在业务逻辑的开发。

不过在实现这个例子的时候,一个部署ejb的典型错误又发生了,就是tag语句写错了,这些东西都是只有在部署后才可以知道,不可以编译来校验,而且出了错也不容易找,真是麻烦。唯一的办法就是打开lomboz的文档,然后复制粘贴,希望这样会少一点错误。或者等我找到更加先进的工具进行校验,暂时就只好这样子了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值