﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-yellowstonemay-文章分类-JAVA EE - EJB - GLASSFISH</title><link>http://www.blogjava.net/yellowstonemay/category/41740.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 19 Sep 2009 04:54:35 GMT</lastBuildDate><pubDate>Sat, 19 Sep 2009 04:54:35 GMT</pubDate><ttl>60</ttl><item><title>create EAR project in glassfish bundle for eclipse</title><link>http://www.blogjava.net/yellowstonemay/articles/295649.html</link><dc:creator>yellowstone</dc:creator><author>yellowstone</author><pubDate>Sat, 19 Sep 2009 03:01:00 GMT</pubDate><guid>http://www.blogjava.net/yellowstonemay/articles/295649.html</guid><wfw:comment>http://www.blogjava.net/yellowstonemay/comments/295649.html</wfw:comment><comments>http://www.blogjava.net/yellowstonemay/articles/295649.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yellowstonemay/comments/commentRss/295649.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yellowstonemay/services/trackbacks/295649.html</trackback:ping><description><![CDATA[The following tutorial should explain how to build your own JEE Web/EJB Project in Eclipse. I use Glassfish Tools Bundle for Eclipase 1.1, which contain glassfish applicatin server and eclipase 3.4 IDE.<br />
<p>Finally our project consits of three modules. </p>
<ol>
    <li>EJB module with the&nbsp; workflow components and also webservices
    <li>Web module which contains the business logic of our business process. Things like forms and search pages
    <li>EAR module which fits all together an represents the deployment unit which we will provide to our system integrator. </li>
</ol>
Start your Eclipse Workbench:<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-01.jpg" width="771" height="579" /><br />
<br />
Build the EJB Module :<br />
start using the first Eclipse JEE Wizard -&gt; create EJB module <br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-02.jpg" width="379" height="212" /><br />
then enter your project name and check on the "EAR member", click next<br />
<img style="width: 357px; height: 421px" border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-03.jpg" width="357" height="421" /><br />
from next wizard page, choose if to create a EJB&nbsp; client JAR module and click finish.<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-04.jpg" width="318" height="374" /><br />
<br />
Now&nbsp;&nbsp;your Workspace structure should look like this: <br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-05.jpg" width="274" height="356" /><br />
<br />
<h3>ejb-jar.xml</h3>
<p>The ejb-jar.xml deployment descriptor is used to provide unique names of the workflow ejb components. As the ejbs in JEE 5 use annotations to declare there behaviour there is no need for an ejb deployment descriptor. But when you plan to develop more then one application the names of the EJB need to be unique. </p>
<h3>sun-ejb-jar.xml</h3>
<p>The&nbsp; sun-ejb-jar.xml descriptor is the glassfish specific descriptor. </p>
<br />
<h2>Build the Web Module</h2>
<p>Now we can create our web project were we put in all our application logic. Start again the Eclipse New-Project-Wizard and select "Web-&gt;dynamic web module</p>
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-06.jpg" width="484" height="496" /><br />
<br />
click finish, you will get:<br />
<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-07.jpg" width="319" height="290" /><br />
Notice that the web project is already added to as a EAR module.<br />
now, you can develop your EJB module and WEB module. After you finish your coding, you can deploy them. It is very simple to do this, just right click the MyFistAppEar project and choose "run on server":<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-08.jpg" width="554" height="329" /><br />
then you can directly choose "finish" on following wizard page:<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-09.jpg" width="391" height="495" /><br />
the myFirstAppEAR will be&nbsp;automatically deployed to glassfish application server.<br />
Hope from console window, you can see following message that prove your deployment is done correctly.<br />
<em><font style="background-color: #c5e4c5">deploy:<br />
&nbsp;&nbsp;&nbsp;&nbsp; [exec] Command deploy executed successfully.<br />
deploy-url-message:<br />
&nbsp;&nbsp;&nbsp;&nbsp; [echo] Application Deployed at: http://localhost:8082/myFirstAppEAR</font><br />
<br />
</em>Let us go to glassfish admin console to see what happen on the application server:<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-deploy01.jpg" width="728" height="110" /><br />
and you will see glassfish admin web page: <br />
--&gt;input username admin and password "adminadmin"<br />
--&gt;choose the "Enterprise Application" in the left menu bar<br />
you will see&nbsp; that myFirstAppEAR is in the list on the right window like following:<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-deploy02.jpg" width="703" height="231" /><br />
click the "myFirstAppEAR", you can see more detail, like EJB module and WEB module in it.<br />
<img border="0" alt="" src="http://www.blogjava.net/images/blogjava_net/yellowstonemay/eclipse-glassfish/eclipse-glassfish-deploy03.jpg" width="645" height="333" /><br />
<img src ="http://www.blogjava.net/yellowstonemay/aggbug/295649.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yellowstonemay/" target="_blank">yellowstone</a> 2009-09-19 11:01 <a href="http://www.blogjava.net/yellowstonemay/articles/295649.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>