5 Replies Latest reply on Jan 30, 2006 1:13 PM by sbalmos

    Controlling deployment order in EAR

    sbalmos

      Hi all,

      I'm wondering if there's any way to control the deployment order of services defined in jboss-app.xml of an EAR. Preferrably, in the order they exist in the XML config. :)

      My issue is that, in my jboss-app.xml file, I have defined a -ds.xml type service for my JDBC DataSource, and then I have defined a -service.xml type service for Hibernate. Apparently when processing the subdeployments of an EAR, JBoss follows the (default) DeploymentSorter order. Which means no matter what I do, the Hibernate -service.xml file will be processed before the DataSource -ds.xml file, and we get nowhere since Hibernate complains it (rightfully) has no data source to connect to.

      This continues to occur even when I change the sorter to the PrefixDeploymentSorter in conf/jboss-service.xml and prepend a 1 to the -ds file and a 2 to the Hibernate file.

      I'm open to ideas, suggestions, etc. Would love to know why it would be so hard to simply deploy in the order they're declared in jboss-app.xml & application.xml. :D

      Thanks!

      --Scott

        • 1. Re: Controlling deployment order in EAR
          dimitris

          I would think this is solved in JBoss v.4.0.3:

          http://jira.jboss.com/jira/browse/JBAS-1876

          Do you use an older version?

          • 2. Re: Controlling deployment order in EAR
            sbalmos

            Nope. JBoss 4.0.3SP1 (12:09:56,856 INFO [Server] Release ID: JBoss [Zion] 4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231751)). See below for jboss-app.xml, application.xml, and deployment trace. You can clearly see that even though the datasource xml is listed first, it doesn't get processed until after Hibernate. And even though application.xml lists things in odd orders, all the JARs & WARs get loaded in alphabetical order - the order that DeploymentScanner would use.

            <?xml version="1.0"?>
            <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
            "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
            <jboss-app>
            META-INF/1postgresql-ds.xml
            META-INF/2hibernate-service.xml
            </jboss-app>

            <?xml version="1.0" encoding="UTF-8"?>
            <application version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
            <display-name>SimuNex Backend</display-name>

            Backend-Core.jar


            Backend-Billing.jar


            Backend-DiscussNet.jar


            Backend-GameMgr.jar


            Backend-ArcRecMgr.jar


            Backend-EventsCal.jar


            Backend-NetworkMgr.jar


            Backend-NewsMgr.jar


            Backend-PlayerMatch.jar


            Backend-SimQA.jar


            Backend-Store.jar



            <web-uri>Backend-EventsCal-Servlets.war</web-uri>
            <context-root>/events</context-root>




            <web-uri>Backend-NewsMgr-Servlets.war</web-uri>
            <context-root>/news</context-root>




            [2006-01-29 12:11:04,236] Module Backend: Module is being deployed, please wait...
            12:11:04,352 INFO [EARDeployer] Init J2EE application: file:/Users/sbalmos/IdeaProjects/SimuNex/Backend/SimuNex-Backend.ear
            12:11:08,938 INFO [Environment] Hibernate 3.1
            12:11:08,964 INFO [Environment] hibernate.properties not found
            12:11:08,969 INFO [Environment] using CGLIB reflection optimizer
            12:11:08,971 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
            12:11:09,504 INFO [Configuration] Searching for mapping documents in jar: Backend-DiscussNet.jar
            12:11:09,506 INFO [Configuration] Searching for mapping documents in jar: Backend-GameMgr.jar
            12:11:09,508 INFO [Configuration] Searching for mapping documents in jar: Backend-Core.jar
            12:11:09,509 INFO [Configuration] Searching for mapping documents in jar: Backend-EventsCal.jar
            12:11:09,511 INFO [Configuration] Searching for mapping documents in jar: tmp62142SimuNex-Backend.ear
            12:11:09,512 INFO [Configuration] Searching for mapping documents in jar: Backend-PlayerMatch.jar
            12:11:09,514 INFO [Configuration] Searching for mapping documents in jar: Backend-NetworkMgr.jar
            12:11:09,624 INFO [Configuration] Searching for mapping documents in jar: Backend-NewsMgr.jar
            12:11:09,625 INFO [Configuration] Searching for mapping documents in jar: Backend-ArcRecMgr.jar
            12:11:09,627 INFO [Configuration] Searching for mapping documents in jar: Backend-Billing.jar
            12:11:09,629 INFO [Configuration] Searching for mapping documents in jar: Backend-Store.jar
            12:11:09,631 INFO [Configuration] Searching for mapping documents in jar: Backend-SimQA.jar
            12:11:09,637 INFO [Configuration] processing extends queue
            12:11:09,637 INFO [Configuration] processing collection mappings
            12:11:09,638 INFO [Configuration] processing association property references
            12:11:09,639 INFO [Configuration] processing foreign key constraints
            12:11:09,665 INFO [NamingHelper] JNDI InitialContext properties:{}
            12:11:09,694 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/SNXDbConPool
            javax.naming.NameNotFoundException: SNXDbConPool not bound
            ... trace messages ...
            12:11:09,756 WARN [ServiceController] Problem starting service SimuNex:name=SNXHibernatePool
            org.hibernate.HibernateException: Could not find datasource
            ... trace messages ...
            Caused by: javax.naming.NameNotFoundException: SNXDbConPool not bound
            ... trace messages ...
            12:11:10,031 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=/SNXDbConPool' to JNDI name 'java:/SNXDbConPool'
            12:11:10,068 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-ArcRecMgr.jar
            12:11:10,105 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-Billing.jar
            12:11:10,129 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-Core.jar
            12:11:10,432 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-DiscussNet.jar
            12:11:10,517 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-EventsCal.jar
            12:11:10,543 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-GameMgr.jar
            12:11:10,574 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-NetworkMgr.jar
            12:11:10,603 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-NewsMgr.jar
            12:11:10,629 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-PlayerMatch.jar
            12:11:10,652 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-SimQA.jar
            12:11:10,675 INFO [EJBDeployer] Deployed: file:/Applications/jboss-4.0.3SP1/server/default/tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-Store.jar
            12:11:10,998 INFO [TomcatDeployer] deploy, ctxPath=/events, warUrl=.../tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-EventsCal-Servlets.war/
            12:11:11,545 INFO [JBossCacheManager] init(): replicationGranularity_ is 0 and invaldateSessionPolicy is 2
            12:11:11,613 INFO [JBossCacheManager] Starting JBossManager
            12:11:11,885 INFO [TomcatDeployer] deploy, ctxPath=/news, warUrl=.../tmp/deploy/tmp62142SimuNex-Backend.ear-contents/Backend-NewsMgr-Servlets.war/
            12:11:12,149 INFO [JBossCacheManager] init(): replicationGranularity_ is 0 and invaldateSessionPolicy is 2
            12:11:12,386 INFO [JBossCacheManager] Starting JBossManager
            12:11:12,500 INFO [EARDeployer] Started J2EE application: file:/Users/sbalmos/IdeaProjects/SimuNex/Backend/SimuNex-Backend.ear
            [2006-01-29 12:11:12,560] Module Backend: Module is deployed successfully.

            In the mess of trace messages from Hibernate, I noted this part concerning the deployment process, which might be of help:

            at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:979)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)

            Thanks for further assistance!

            --Scott

            • 3. Re: Controlling deployment order in EAR
              sbalmos

              Okay, jboss-app.xml & application.xml got chewed by the message board. Imagine there are appropriate module tags in both. ;)

              --Scott

              • 4. Re: Controlling deployment order in EAR

                Try checking out the DEPENDS attribute

                • 5. Re: Controlling deployment order in EAR
                  sbalmos

                  Took some poking around to get the depends tag right, but I got it.

                  Thanks!

                  --Scott