http://www.developer.com/java/ent/article.php/3491091/Deploying-and-Consuming-EJBs-in-Java-Studio-Creator.htm
In Part 1 of this series, I described the steps to create a Session EJB-based API that was suitable for use within Java Studio Creator. Part 2 details the steps necessary to deploy and consume that EJB layer within Java Studio Creator (henceforth referred to as Creator for brevity). Part 3 will give more specifics on strategies to use and bind data from such an API in Creator. Deploying in J2EE can be quite an art. For use of the EJB API in Creator, there are really two distinct operations: deploying the EJB API, and deploying any support libraries needed for that API. It is quite likely that your other tools, or persistence layer, or any one of a number of third-party libraries you have included in your middle-tier construction, bring dependencies in the form of support jar libraries that are needed within the classpath of the run environment to allow the eventual application to run. There are two options for providing these support libraries within the run stack. One is to bundle them into the API Ear, and the other is to make them available within the application server environment. I will give a brief description of each option below, along with advantages and disadvantages: This is really the simplest option both to understand and to carry out. Any dependencies for the EJB API can be rolled into the EJB Ear file, usually the IDE you use to construct the EJB API will make this easy. Advantages of this include an easily distributable Enterprise Archive with all dependencies already rolled into it, and little extra work needed in the deployment (just put the Ear file out there and everything necessary is already included). The main disadvantage of this approach is size. With all of the support libraries included in the Ear file, it will get very large. If you have more than one application being put on a particular server, using the same persistence and other supporting libraries, you will end up with each Ear duplicating numerous files and taking up more space than is necessary. Instead of rolling everything into the Ear, the other option is to take those libraries that are likely to be shared between Web applications and make them available to the whole application server. Following is a brief description of the steps necessary to do this in Sun App Server 8 PE (which is the application server used by Creator to run the applications): Now you have the support libraries in place, it's time to deploy the enterprise archive file ready for Creator to consume it. A good guide to doing that is available from the Sun Java Studio Creator Web site: http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/EJBcomps_building.html. Please refer to this for a more in-depth description of what to do. In a nutshell, the steps are: Okay, we have deployed the EJB enterprise archive file, and we have the client stubs to access it. Now, we have to import those into Creator. This is pretty easy: Creator now knows about the EJB. To use it in a page, open the set and select the EJB you want to use, drag and drop it on the page, and it will create a reference to it on that page. It will do the lookup and narrow, and make it ready for your use in general. More information and examples on doing this exist in the http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/EJBcomps_building.html document. Refreshing the EJB API: after deploying a new version of the EJB API to the app server, you will want to update the references in Creator, and also in the projects that use that EJB API. The steps to do this are: This article has covered in general the steps necessary to create an API based on Session EJBs suitable for use in a Creator project, and further, the consumption of that API using Creator. Examples were kept general when given, but tended towards explanation using the JDeveloper IDE that is what we use internally at NewEnergy Associates. It is hoped that these examples will provide enough insight to provide clues to accomplishing the same in other tools. The article stops short of giving examples of actually writing Creator back-end code using the EJB API. There are examples of this in the document provided (Using EJBs in Creator), but it may also be something I cover in greater detail in future articles (particularly going into greater depth of returning serializable beans from the EJB API and using them to set data or even directly bind into a Creator page control). http://www.informit.com/articles/article.asp?p=21630&rl=1—Creating Session EJBs http://www.oracle.com/technology/obe/obe9051jdev/EJBtoJSP/defaultejb.htm—Oracle JDeveloper-specific EJB creation. http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/EJBcomps_building.html—Using EJBs in Creator. http://devservices.sun.com/premium/jscreator/standard/learning/tutorials/aboutdeployment.html—Sun guide to deployment Dick Wall is a Lead Systems Engineer at NewEnergy Associates, a Siemens Company based in Atlanta, GA that provides energy IT and consulting solutions for decision support and energy operations. He can be reached for comment on this and other matters at dick.wall@newenergyassoc.com.
Deploying and Consuming EJBs in Java Studio Creator
March 21, 2005
Deploying the EJB Enterprise Archive to Sun App Server 8 PE
Deployment as Part of the Enterprise Archive
Deployment Within the Application Server
Deployment of Your Enterprise Archive file
Consuming the EJBs Within Creator
Some Gotchas
Conclusion
For Further Information
About the Author