9 Replies Latest reply on Aug 1, 2012 7:51 AM by Fernando Costa

    jboss5 deploy sequence

    abhinav goel Newbie

      hi
      i am not able to understand the deploy sequence of jboss5. earlier i used 4.0.2, thr was no prob in that. i put my application.sar and -ds.xml in deploy folder. jboss5 deploys sar prior to -ds.xml and it gives exception that datasource not found. in the log after that exception i can see that my datasource is bound by connection manager. so how can i make to load my -ds.xml file prior to sar file
      please help
      thanks
      abhinav

        • 1. Re: jboss5 deploy sequence
          jaikiran pai Master

          JBoss-5 uses LegacyDeploymentContextComparator:

           <bean name="topContextComparator">
           <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
           </bean>


          And from what i see in it's code:

          static
           {
           legacyOrder = new HashMap<String, Integer>();
           legacyOrder.put(".deployer", 50);
           legacyOrder.put("-deployer.xml", 50);
           legacyOrder.put(".aop", 100);
           legacyOrder.put("-aop.xml", 100);
           legacyOrder.put(".sar", 150);
           legacyOrder.put("-service.xml", 150);
           legacyOrder.put(".beans", 200);
           legacyOrder.put("-jboss-beans.xml", 200);
           legacyOrder.put(".rar", 250);
           legacyOrder.put("-ds.xml", 300);
           legacyOrder.put(".har", 350);
           legacyOrder.put(".jar", 400);
           legacyOrder.put(".ejb3", 400);
           legacyOrder.put(".par", 400);
           legacyOrder.put(".war", 500);
           legacyOrder.put(".wsr", 600);
           legacyOrder.put(".ear", 650);
           legacyOrder.put(".jar", 700);
           legacyOrder.put(".zip", 750);
           legacyOrder.put(".bsh", 800);
           legacyOrder.put(".last", 900);
           }
          


          .sar is deployed before -ds.xml.


          so how can i make to load my -ds.xml file prior to sar file


          One way to do this, is create a deploy.last folder inside the %JBOSS_HOME%/server/< serverName>/deploy folder. And then place the .sar in that %JBOSS_HOME%/server/< serverName>/deploy/deploy.last. Let the -ds.xml remain in the deploy folder. This way, the sar will be deployed last.

          The other way would be to add a "depends" element in the -service.xml of your .sar to add a dependency on the datasource. This way, the sar will not be deployed till your datasource is deployed.

          P.S: Off topic, i see that the .jar is listed twice in the LegacyDeploymentContextComparator. Once with order 400 and then again with order 700.


          • 2. Re: jboss5 deploy sequence
            abhinav goel Newbie

            thanks jaikiran for the quick reply.
            i will try that 'depends' method.
            i also found a typical problem which somebody else also faced.
            jboss5 is very strict with DTD of xml files. there was no solution other than making xml correctly. is thr any tweak to make jboss5 less lenient. i dont have any problems in making my own xml files correctly but it catches errors in product jars also which is impossible to change for all the jars and not gud for future use also. every jar having xml have to be correct before using it. can u help me in this issue?
            thanks

            • 3. Re: jboss5 deploy sequence
              jaikiran pai Master

               

              "abhinav.ind" wrote:

              i also found a typical problem which somebody else also faced.
              jboss5 is very strict with DTD of xml files.
              is thr any tweak to make jboss5 less lenient.


              You can definitely make it less strict. But i am not sure whether there is a single place/configuration which can do that. As far as i know, it has to be done per deployer.

              For example, in the %JBOSS_HOME%/server/< serverName>/deployersear-deployer-jboss-beans.xml you will find the commented out lines:

              <!-- uncomment to disable xml validation property name="useValidation">false</property -->

              So uncomment them to:

              <property name="useValidation">false</property>


              • 4. Re: jboss5 deploy sequence
                abhinav goel Newbie

                thanks jaikiran, both of your suggestions worked perfectly.
                cheers :)

                • 5. Re: jboss5 deploy sequence
                  abhinav goel Newbie

                  one more thing i wud like to know. my server log shows this :

                  09:06:33,908 WARN [QuartzTimerServiceFactory] sql failed: CREATE i TABLE qrtz_job_details


                  i created this table and qrtz_locks table separately using sqlplus and it executed without errors. i m using oracle. i replaced the presistence file from examples for oracle. after manually creating these two tables n inserting data in them, i dont get exceptions, but i still get this WARN message. how can this be rectified so that both tables r created automatically.
                  thanks

                  • 7. Re: jboss5 deploy sequence
                    abhinav goel Newbie

                    m i making some minor stupid mistake????

                    • 8. Re: jboss5 deploy sequence
                      jaikiran pai Master

                       

                      "abhinav.ind" wrote:
                      m i making some minor stupid mistake????


                      Honestly, i lost track of what we were discussing :) For new issues, its always better to create new threads.

                      one more thing i wud like to know. my server log shows this :


                      09:06:33,908 WARN [QuartzTimerServiceFactory] sql failed: CREATE i TABLE qrtz_job_details


                      You will have to give us more details. When do you see this WARN message? How does it affect the application?

                      i created this table and qrtz_locks table separately using sqlplus and it executed without errors. i m using oracle. i replaced the presistence file from examples for oracle. after manually creating these two tables n inserting data in them, i dont get exceptions,


                      Without knowing the context of why you are doing this, its difficult to say what's wrong. Please provide more details, preferably in a new thread in an appropriate forum.


                      • 9. Re: jboss5 deploy sequence
                        Fernando Costa Newbie

                        I have the same problem originally reported by abhinav goel in this thread, but when i put my sar application inside deploy.last, i got into a classpath nightmare. Apparently, jboss 5 isn't finding jar files inside the sar's lib directory. If I try to include a "depends" tag on jboss-service.xml, it doesn't work as expected and the error of dependency keeps alive.

                         

                        SAR Structure:

                         

                        - br

                        -- com

                        --- diasoft

                        ---- nfe

                        ----- service

                        ----- dao

                        ----- pojo

                        ----- xml

                        ----- util

                        - lib

                        - META-INF

                         

                        <!-- jboss-service.xml -->

                         

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

                        <mbean code="br.com.diasoft.nfe.service.dowloader"

                            name="nfe.diasoft.com.br:service=Downloader">   

                            <depends>jboss.jca:service=DataSourceBinding,name=JDBC/DonwloaderServiceConector</depends>   

                        </mbean>

                         

                        My datasouce is placed under:

                         

                        /jboss-5.1.0.GA/server/default/deploy

                         

                        SAR under:

                         

                        /jboss-5.1.0.GA/server/default/deploy/deploy.last