Tutorial for building J2EE Applications using JBOSS and ECLIPSE Chapter 3

來源:互聯網
上載者:User

在閱讀這一章的時候,基本沒有什麼障礙,但是有一個地方文章是寫錯了。

在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的文檔,然後複製粘貼,希望這樣會少一點錯誤。或者等我找到更加先進的工具進行校正,暫時就只好這樣子了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.