4 Replies Latest reply on Sep 15, 2003 7:13 PM by no_ejb

    How to deploy an J2EE .ear file on JBoss 3.2

    jeromaqui Newbie


      I have an application written to J2EE specifications that I would like to deploy on JBoss. There are several files (for the J2EE deployment) that are copied to the J2EE directory. These include lib\system\odbc.jar and bin\[fonts] that the .ear uses. I do not know in JBoss where to put these files as the directory structure is different. Thanks in advance for any help on this.
      Jeremy

        • 1. Re: How to deploy an J2EE .ear file on JBoss 3.2
          nusa Novice

          Put your .ear into <your-config>/deploy

          • 2. Re: How to deploy an J2EE .ear file on JBoss 3.2
            jeromaqui Newbie

            I got that part. The problem that I am running into is that there are several files that I have to manually copy to the J2EE directory as mentioned in my first message. Due to jBoss directory structure being different from J2EE, I do not know where to put these files.

            • 3. Re: How to deploy an J2EE .ear file on JBoss 3.2
              davem Newbie

              have you tried putting your odbc.jar and your fonts file in the

              $JBOSS_HOME/server/yourserver/lib?

              • 4. Re: How to deploy an J2EE .ear file on JBoss 3.2
                no_ejb Newbie

                Believe it or not, I tried to profile a EJB to an O/R mapping a while back. So I had to package ear file. So long story short, here is the structure I have which should answer your question, and much more than you asked since I just want to document this so that in the future I will be able to search jboss website instead of my hard-disk. The version I used is not 3.2, I used 3.0.4 Tomcat 4.12 but I guess the structure did not change too much.


                Content of trade_infr.ear
                --MANIFEST.MF
                --lib
                --junit.jar
                --junitejb.jar
                --application.xml
                --trade_infr.jar
                Content of trade.jar
                --all your classes
                --META-INF
                --ejb-jar.xml
                --jboss.xml
                --jbosscmp-jdbc.xml
                --MANIFEST.MF
                Let's explain more here.

                In application.xml, I have

                <display-name>My Trade Infr Ear</display-name>

                trade_infr.jar


                This is stardard from Sun.

                I have the Class-path: ./lib/junit.jar ./lib/junitejb.jar in both of the MANIFEST.MF files because I was confused at begining, I got it figured out but I forgot it again, so don't shoot me on this, my feeling it is the MANIFEST.MF in the jar file's class path matters. Well it is very easy to test I guess.

                So your answer is : the libraries goes to ear's lib dir if you don't want to share them with other ear. The font's stuff I guess you can put anywhere in the classpath, then you can load them using resource bundle.

                You can skip rest of the email here since it is for my own benefit only. The attachments did not seem to working for me so I post the entire xmls inline. Sorry for the lengthy email.

                -----------------------ejb-jar.xml------------------------
                <?xml version="1.0"?>

                <!DOCTYPE ejb-jar PUBLIC
                "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
                "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

                <ejb-jar>
                <enterprise-beans>

                JUnit Session Bean Test Runner
                <ejb-name>EJBTestRunnerEJB</ejb-name>
                net.sourceforge.junitejb.EJBTestRunnerHome
                net.sourceforge.junitejb.EJBTestRunner
                <ejb-class>net.sourceforge.junitejb.EJBTestRunnerBean</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Bean</transaction-type>

                <!-- start of my ejb decclaration
                User to account is many to many bidirectional
                account to order is one to many bidirectional
                order to execution is one to many bidirectional
                -->


                User Bean
                <ejb-name>User_EJB</ejb-name>
                <local-home>com.ts.eq.ejb.UserHome</local-home>
                com.ts.eq.ejb.User
                <ejb-class>com.ts.eq.ejb.UserBean</ejb-class>
                <persistence-type>Container</persistence-type>
                <prim-key-class>java.lang.Integer</prim-key-class>
                False
                <cmp-version>2.x</cmp-version>
                <abstract-schema-name>User</abstract-schema-name>
                <cmp-field>
                <field-name>id</field-name>
                </cmp-field>
                <primkey-field>id</primkey-field>


                Account Bean
                <ejb-name>Account_EJB</ejb-name>
                <local-home>com.ts.eq.ejb.AccountHome</local-home>
                com.ts.eq.ejb.Account
                <ejb-class>com.ts.eq.ejb.AccountBean</ejb-class>
                <persistence-type>Container</persistence-type>
                <prim-key-class>java.lang.Integer</prim-key-class>
                False
                <cmp-version>2.x</cmp-version>
                <abstract-schema-name>Account</abstract-schema-name>
                <cmp-field>
                <field-name>id</field-name>
                </cmp-field>
                <primkey-field>id</primkey-field>


                Order Bean
                <ejb-name>Order_EJB</ejb-name>
                <local-home>com.ts.eq.ejb.OrderHome</local-home>
                com.ts.eq.ejb.Order
                <ejb-class>com.ts.eq.ejb.OrderBean</ejb-class>
                <persistence-type>Container</persistence-type>
                <!-- you can specify any class -->
                <prim-key-class>java.lang.Integer</prim-key-class>
                False
                <cmp-version>2.x</cmp-version>
                <!-- schema name is used for alias in Query -->
                <abstract-schema-name>Order</abstract-schema-name>
                <cmp-field>
                <field-name>id</field-name>
                </cmp-field>
                <primkey-field>id</primkey-field>


                Execution Bean
                <ejb-name>Execution_EJB</ejb-name>
                <local-home>com.ts.eq.ejb.ExecutionHome</local-home>
                com.ts.eq.ejb.Execution
                <ejb-class>com.ts.eq.ejb.ExecutionBean</ejb-class>
                <persistence-type>Container</persistence-type>
                <!-- you can specify any class -->
                <prim-key-class>java.lang.Integer</prim-key-class>
                False
                <cmp-version>2.x</cmp-version>
                <!-- schema name is used for alias in Query -->
                <abstract-schema-name>Execution</abstract-schema-name>
                <cmp-field>
                <field-name>id</field-name>
                </cmp-field>
                <primkey-field>id</primkey-field>

                <!-- End of my ejb decclaration -->
                </enterprise-beans>


                <!-- start of my ejb relation -->
                <ejb-relation>
                <ejb-relation-name>UserAccount_ManyToMany_Bi</ejb-relation-name>
                <ejb-relationship-role>
                <ejb-relationship-role-name>User-has-Accounts</ejb-relationship-role-name>
                Many
                <relationship-role-source>
                <ejb-name>User_EJB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>accounts</cmr-field-name>
                <cmr-field-type>java.util.Set</cmr-field-type>
                </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                <ejb-relationship-role-name>Account-has-Users</ejb-relationship-role-name>
                Many
                <relationship-role-source>
                <ejb-name>Account_EJB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>users</cmr-field-name>
                <cmr-field-type>java.util.Set</cmr-field-type>
                </cmr-field>
                </ejb-relationship-role>
                </ejb-relation>
                <ejb-relation>
                <ejb-relation-name>AccountOrder_OneToMany_Bi</ejb-relation-name>
                <ejb-relationship-role>
                <ejb-relationship-role-name>Account-has-Orders</ejb-relationship-role-name>
                One
                <relationship-role-source>
                <ejb-name>Account_EJB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>orders</cmr-field-name>
                <cmr-field-type>java.util.Set</cmr-field-type>
                </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                <ejb-relationship-role-name>Order-belongsto-Account</ejb-relationship-role-name>
                Many
                <cascade-delete/>
                <relationship-role-source>
                <ejb-name>Order_EJB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>account</cmr-field-name>
                </cmr-field>
                </ejb-relationship-role>
                </ejb-relation>
                <ejb-relation>
                <ejb-relation-name>OrderExecution_OneToMany_Bi</ejb-relation-name>
                <ejb-relationship-role>
                <ejb-relationship-role-name>Order-has-Executions</ejb-relationship-role-name>
                One
                <relationship-role-source>
                <ejb-name>Order_EJB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>executions</cmr-field-name>
                <cmr-field-type>java.util.Set</cmr-field-type>
                </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                <ejb-relationship-role-name>Executions-belongsto-Order</ejb-relationship-role-name>
                Many
                <cascade-delete/>
                <relationship-role-source>
                <ejb-name>Execution_EJB</ejb-name>
                </relationship-role-source>
                <cmr-field>
                <cmr-field-name>owner</cmr-field-name>
                </cmr-field>
                </ejb-relationship-role>
                </ejb-relation>

                <!-- end of my ejb relation -->

                <assembly-descriptor>
                <container-transaction>

                <ejb-name>User_EJB</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>Required</trans-attribute>
                </container-transaction>
                <container-transaction>

                <ejb-name>Account_EJB</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>Supports</trans-attribute>
                </container-transaction>
                <container-transaction>

                <ejb-name>Order_EJB</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>Supports</trans-attribute>
                </container-transaction>
                <container-transaction>

                <ejb-name>Execution_EJB</ejb-name>
                <method-name>*</method-name>

                <trans-attribute>Supports</trans-attribute>
                </container-transaction>
                </assembly-descriptor>
                </ejb-jar>

                ----------------jboss.xml--------------------------------
                <?xml version="1.0" encoding="utf-8"?>


                <enterprise-beans>

                <ejb-name>EJBTestRunnerEJB</ejb-name>
                <jndi-name>ejb/EJBTestRunner</jndi-name>



                <ejb-name>User_EJB</ejb-name>
                <local-jndi-name>tradeInfr/User</local-jndi-name>


                <ejb-name>Account_EJB</ejb-name>
                <local-jndi-name>tradeInfr/Account</local-jndi-name>



                <ejb-name>Order_EJB</ejb-name>
                <local-jndi-name>tradeInfr/Order</local-jndi-name>


                <ejb-name>Execution_EJB</ejb-name>
                <local-jndi-name>tradeInfr/Execution</local-jndi-name>

                </enterprise-beans>


                -----------------------jbosscmp-jdbc.xml--------------
                <?xml version="1.0" encoding="UTF-8"?>

                <!DOCTYPE jbosscmp-jdbc PUBLIC
                "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
                "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">

                <jbosscmp-jdbc>


                <create-table>true</create-table>
                <remove-table>true</remove-table>
                <pk-constraint>true</pk-constraint>
                <read-ahead>on-find</read-ahead>



                <ejb-relation>
                <ejb-relation-name>UserAccount_ManyToMany_Bi</ejb-relation-name>
                <relation-table-mapping>
                <table-name>user_acct_map</table-name>
                </relation-table-mapping>
                </ejb-relation>

                <ejb-relation>
                <ejb-relation-name>AccountOrder_OneToMany_Bi</ejb-relation-name>
                <foreign-key-mapping/>
                </ejb-relation>

                <ejb-relation>
                <ejb-relation-name>OrderExecution_OneToMany_Bi</ejb-relation-name>
                <foreign-key-mapping/>
                </ejb-relation>

                </jbosscmp-jdbc>