Date: 2004-08-13T12:56:31 Editor: JacekLaskowski <[EMAIL PROTECTED]> Wiki: Apache Geronimo Wiki Page: PetStore URL: http://wiki.apache.org/geronimo/PetStore
The past instructions removed as they confused people Change Log: ------------------------------------------------------------------------------ @@ -245,91 +245,3 @@ at org.apache.geronimo.kernel.Kernel.invoke(Kernel.java:231) at org.apache.geronimo.system.main.CommandLine.main(CommandLine.java:93) }}} - - 1. Create '''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 as shown below: {{{ - <mbean descriptor="org.apache.geronimo.kernel.deployment.scanner.DeploymentScanner" - name="geronimo.deployment:role=DeploymentScanner"> - <constructor> - <arg type="java.net.URL[]">${geronimo.home}/deploy/,${geronimo.home}/petstore/,</arg> - <arg type="long">5000</arg> - </constructor> - </mbean> -}}} Once this is done, Geronimo will monitor the directory and attempt to deploy resources that are in the directory. - 1. Define a connection-definition of your choice in J2EECA JDBC implementation's specific way. (For OpenJCA, you can edit ''META-INF/geronimo-ra.xml'' contained in openejb-jca-DEV.jar) - - 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 petstore\petstore.ear\asyncsender-ejb - - * cd petstore\petstore.ear\asyncsender-ejb\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 following PetStore jars (found in the same directory as petstore.war) - 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 to '''target/geronimo-DEV/lib''' directory. - - 1. Unjar petstore.war and place it in Geronimo's petstore/petstore.ear directory. Perform the following steps: - - * mkdir petstore\petstore.ear\petstore - - * cd petstore\petstore.ear\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 (''incubator-geronimo/target/geronimo-DEV/lib'' to be precise) directory and having them in that directory would result in 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 are defined in 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. Change '''<res-ref-name>jdbc/CatalogDB</res-ref-name>''' stanza to: - - {{{ - <resource-ref> - <description>Allow the Fast Lane Reader Pattern to Read Catalog Data Directly via JDBC in the Web Tier</description> - <res-ref-name>jdbc/CatalogDB</res-ref-name> - <res-type>javax.sql.DataSource</res-type> - <res-auth>Container</res-auth> - <jndi-name>geronimo.management:j2eeType=JCAManagedConnectionFactory,name=petstoredb</jndi-name> - </resource-ref> -}}} - - Note the <jndi-name> tag which is Geronimo approach to define what the resource-ref points to. - - i. Change '''<res-ref-name>url/CatalogDAOSQLURL</res-ref-name>''' stanza to: - - {{{ - <resource-ref> - <res-ref-name>url/CatalogDAOSQLURL</res-ref-name> - <res-type>java.net.URL</res-type> - <res-auth>Container</res-auth> - <jndi-name>http://localhost:8080/petstore/CatalogDAOSQL.xml</jndi-name> - </resource-ref> -}}} - - * 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 beginning.