1 2 Previous Next 15 Replies Latest reply on Jan 27, 2009 4:52 AM by alesj

    How to deploy a PoJo service in AS5

    garymarsh

      I have two Pojo classes plus several helper classes that I have in a jar file called DMServer.jar which I have placed in my <JBossAS5>/server//lib directory. I have placed the DMServer-beans.xml file in my <JBossAS5>/server//nichpro-deploy directory but the service never starts when the server is run.

      Here is the add code that I put into the profile.xml file to make the nichpro-deploy directory auto-scanned :

       <!-- Scan for applications -->
       <bean name="VFSDeploymentScanner" class="org.jboss.system.server.profileservice.VFSDeploymentScannerImpl">
       <property name="profileService"><inject bean="ProfileService"/></property>
       <property name="filterInstance"><inject bean="DeploymentFilter"/></property>
       <property name="URIList">
       <list elementClass="java.net.URI">
       <!-- Standard hot deployment directory -->
       <value>${jboss.server.home.url}deploy/</value>
       <value>${jboss.server.home.url}nichpro-deploy/</value>
       </list>
       </property>
       </bean>




      Here is my DMServer-beans.xml listing :
      <?xml version="1.0" encoding="UTF-8"?>
      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      
       <bean name="AgentFactory" class="com.nichpro.factory.AgentFactory" />
      
       <bean name="DirectoryMonitor" class="com.nichpro.monitor.DirMonitor.Impl" />
      
      </deployment>
      



      What more do I need to do to hot deploy this service?

      GMarsh

        • 1. Re: How to deploy a PoJo service in AS5
          alesj

           

          "Gary Marsh" wrote:

          What more do I need to do to hot deploy this service?

          It might be that the current HD impl only uses first element of that URIList,
          hence your nichpro-deploy is never used.

          What about if you put your nichprop-deploy as the first element in that list?

          • 2. Re: How to deploy a PoJo service in AS5
            brian.stansberry

            Doesn't the file have to be named DMServer-jboss-beans.xml now, following pre-GA feedback that -beans.xml was too common as was leading to non-MC stuff being treated as an Microcontainer deployment descriptor?

            • 3. Re: How to deploy a PoJo service in AS5
              peterj

              My testing has shown that in 5.0.0.GA, the Hot Deployer uses every every in the URIList, and not just the first one as was the case in prior releases.

              • 4. Re: How to deploy a PoJo service in AS5
                garymarsh

                I re-arranged the list order in profile.xml with no effect. The curious thing is that when I search the boot.log and the server.log
                files I can't find any reference to the nichpro-deploy directory. I find lots of references to the deploy directory though. I have also
                tried just putting the DMServer-beans.xml file in the deploy directory and this also had no effect.

                GMarsh

                • 5. Re: How to deploy a PoJo service in AS5
                  alesj

                   

                  "Gary Marsh" wrote:
                  I have also
                  tried just putting the DMServer-beans.xml file in the deploy directory and this also had no effect.

                  It must be like Brian says --> *-jboss-beans.xml

                  • 6. Re: How to deploy a PoJo service in AS5
                    alesj

                     

                    "PeterJ" wrote:
                    My testing has shown that in 5.0.0.GA, the Hot Deployer uses every every in the URIList, and not just the first one as was the case in prior releases.

                    I just remembered I once saw urls[0] in code somewhere.
                    But fortunately Brian has a better eye for details. :-)

                    • 7. Re: How to deploy a PoJo service in AS5
                      garymarsh

                      Changing the file name to DMServer-jboss-beans.xml got an immediate response from the JBoss AS.

                      It looks like I have some other issues but at least JBoss sees the deployment file now.

                      Thanks again.

                      GMarsh

                      • 8. Re: How to deploy a PoJo service in AS5
                        garymarsh

                        Looks like the problem I am running into now is where and how are message queues defined? I previously had this running in a microcontainer where the queues were defined in the jbm-jndi.xml file. Is there an equivalent file for defining queues in AS5?

                        GMarsh

                        • 9. Re: How to deploy a PoJo service in AS5
                          garymarsh

                          I should have also mentioned that in the Microcontainer project I also had access to a queue.xml file that defined the actual queue definition.

                          I suppose this would also have to be duplicated in some form in AS5 as well.

                          GMarsh

                          • 10. Re: How to deploy a PoJo service in AS5
                            alesj

                            queue.xml and jbm-jndi.xml?

                            • 11. Re: How to deploy a PoJo service in AS5
                              alesj

                               

                              "alesj" wrote:
                              queue.xml and jbm-jndi.xml?

                              In MC?
                              You probably mean JBoss Messaging?


                              • 12. Re: How to deploy a PoJo service in AS5
                                garymarsh

                                I stand corrected, that would be from the JBoss Messaging.. It gets a little confusing when I start combining these project pieces together.

                                Speaking of which Ales, I borrowed a piece of code from your demo called XmlConfigHandler.java which basically parsed an xml configuration file. The code that I would like to ask about looks like this :

                                private void parseXmlConfigFile( ) {
                                
                                 // get the factory
                                 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance( );
                                
                                 try {
                                
                                 // Using factory get an instance of document builder
                                 DocumentBuilder db = dbf.newDocumentBuilder( );
                                
                                 // parse using builder to get DOM representation of the XML file
                                 dom = db.parse( CONFIG_FILE );
                                
                                 }
                                 catch ( ParserConfigurationException pce ) {
                                 pce.printStackTrace( );
                                 }
                                 catch ( SAXException se ) {
                                 se.printStackTrace( );
                                 }
                                 catch ( IOException ioe ) {
                                 ioe.printStackTrace( );
                                 }
                                 }
                                


                                The code when used in the demo for the Microcontainer would search the classpath for the CONFIG_FILE but in the AS5 environment it searches for the file in the <JBossAs install dir>/bin directory by default. Is there a way to force this search behavior to look in my <installed AS>/server//conf directory instead?

                                GMarsh



                                • 13. Re: How to deploy a PoJo service in AS5
                                  alesj

                                  Where exactly is this code?

                                  • 14. Re: How to deploy a PoJo service in AS5
                                    garymarsh

                                    My mistake, I scrapped that code from another XMLReader code and incorporated it with a piece of your code. Well anyway, the point I was trying to make was that when I run this code in a Microcontainer environment the xml configuration file is found in the classpath. In the AS5 environment it is defaulting to the bin directory directly under the JBoss AS install directory.

                                    How do I change this behavior to search the classpath of the server I am running. Preferably, this would be in my servers conf directory.

                                    GMarsh

                                    1 2 Previous Next