Date: 2004-01-17T17:57:23
   Editor: JacekLaskowski <[EMAIL PROTECTED]>
   Wiki: Apache Geronimo Wiki
   Page: PetStore
   URL: http://wiki.apache.org/geronimo/PetStore

   "Deploying PetStore" unveiled

Change Log:

------------------------------------------------------------------------------
@@ -12,8 +12,70 @@
 
  * Install [wiki:OpenEJBNova OpenEJB Nova Service]
 
+ * Install J2EECA JDBC implementation (more about it later)
+
  * Download 
[http://java.sun.com/blueprints/code/index.html#java_pet_store_demo Java Pet 
Store Demo 1.3.2]
 
 = Deploying PetStore =
 
-to be filled in tonight...
+Before going on, please keep in mind that {{{"whom ever wrote petstore should 
be hunted down..."}}}. It's been said during one IRC session and I couldn't 
resist to include it.
+
+ 1. Define '''petstore''' directory as a place where deployables are to be 
found. Open '''etc/boot-service.xml''' and add '''${geronimo.home}/petstore''' 
after the comma, next to'''${geronimo.home}/deploy''' in 
'''org.apache.geronimo.kernel.deployment.scanner.DeploymentScanner''' MBean.
+
+ Once it's done Geronimo will monitor the directory and attempt to deploy 
resources that are in.
+
+ 1. Define a connection-definition of your choice in J2EECA JDBC 
implementation's specific way. (more about it later)
+
+ 1. Create '''petstore.ear''' directory within petstore directory.
+
+ 1. Unjar every *-ejb.jar file of PetStore and place it in 
petstore/petstore.ear directory. Having the jars unjarred makes it easier to 
introduce changes. So, for example with asyncsender-ejb.jar:
+
+  * mkdir asyncsender-ejb
+
+  * cd asyncsender-ejb
+
+  * jar -xvf <path-to>asyncsender-ejb.jar
+
+ Perform the steps for the rest of EJBs, i.e. cart-ejb.jar, catalog-ejb.jar, 
customer-ejb.jar, petstore-ejb.jar, signon-ejb.jar, uidgen-ejb.jar
+
+ 1. Copy the rest of PetStore jars to lib directory, i.e. 
asyncsender-ejb-client.jar, cart-ejb-client.jar, catalog-ejb-client.jar, 
customer-ejb-client.jar, po-ejb-client.jar, servicelocator.jar, 
signon-ejb-client.jar, tracer.jar, uidgen-ejb-client.jar, xmldocuments.jar.
+
+ 1. Unjar petstore.war and place it in Geronimo's petstore/petstore.ear 
directory. Perform the following steps:
+
+  * mkdir petstore
+
+  * cd petstore
+
+  * jar -xvf <path-to>petstore.war
+
+ 1. Go to petstore/petstore.ear/petstore/WEB-INF/lib directory and remove the 
following files: cart-ejb-client.jar, catalog-ejb-client.jar, 
customer-ejb-client.jar, po-ejb-client.jar, servicelocator.jar, 
signon-ejb-client.jar, tracer.jar. They're already in lib directory and having 
them in that directory would be asking for ClassCastExceptions.
+
+ 1. Go to 
petstore/petstore.ear/petstore/WEB-INF/classes/com/sun/j2ee/blueprints/petstore/controller
 and remove the following directories: ejb, events, exceptions. They're already 
in lib files (as well as they were in the just-removed jars above). Now, you 
understand more the quote above?
+
+ 1. Every deployable has to have Geronimo-specific deployment descriptor 
(g-dd) in META-INF or WEB-INF directory. Web applications have their 
WEB-INF/geronimo-web.xml, and ejbs META-INF/geronimo-ejb-jar.xml. These files 
are created based upon their relatives - WEB-INF/web.xml and 
META-INF/ejb-jar.xml, respectively. With a slight change standard deployment 
descriptor become Geronimo-specific DDs.
+
+  * Creating WEB-INF/geronimo-web.xml
+
+ As there's one web application - petstore.war (unpacked in 
petstore/petstore.ear/petstore directory) the file needs to be created only 
once. Go to petstore/petstore.ear/petstore/WEB-INF directory and make the 
changes:
+
+   i. Copy web.xml into geronimo-web.xml
+
+   i. Remove the line with DOCTYPE (<!DOCTYPE web-app PUBLIC '-//Sun 
Microsystems, Inc.//DTD Web Application 2.3//EN' 
'http://java.sun.com/dtd/web-app_2_3.dtd'>)
+
+   i. Add <module-name>petstore</module-name> after <web-app> tag
+
+   i. Find url/CatalogDAOSQLURL <resource-ref> and add 
<jndi-name>http://localhost:8080/petstore/CatalogDAOSQL.xml</jndi-name> between 
<resource-ref> tags.
+
+  * Creating META-INF/geronimo-ejb-jar.xml
+
+ EJBs have been placed as unpacked in petstore/petstore.ear directory. Go to 
the beans' META-INF directory and perform the steps:
+
+   i. Copy ejb-jar.xml into geronimo-ejb-jar.xml
+
+   i. Remove the line with DOCTYPE (<!DOCTYPE ejb-jar PUBLIC '-//Sun 
Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 
'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>)
+
+   i. Add <module-name>'''EJB-jar_name'''</module-name> after <ejb-jar> tag, 
where EJB-jar_name has to be unique name within the whole set of EJBs. It's 
recommended to choose the name of the file EJBs are in as EJB-jar_name. Thus, 
for asyncsender-ejb.jar it would become 
<module-name>asyncsender-ejb</module-name> .
+
+   i. Add <datasource-name>petstoredb</datasource-name> after <ejb-jar> tag 
(although it's only required for ejb jars with CMPs)
+
+ 1. Enter http://localhost:8080/petstore and have fun. That's just a begining.

Reply via email to