5 Replies Latest reply on Mar 1, 2012 2:06 AM by wdfink

    Starting a stand alone java application in Jboss as7

    sgandhi

      Hi,

       

      I am a new bee to jboss . I have a requirement to start a java standalone application while starting the jboss (i.e while starting the ./standalone.sh ) in Jboss as 7.... where should i provide this in the jboss startup descriptors or jboss descriptor files while the server is starting .

       

      Where shoild i give the following command

      java com.XXX.XXX.myprogram -enableassertions -Xms256m -Xmx1024m -XX:MaxPermSize=192m

       

       

      Iam using mac os....

       

      Thanks in advance,

      SG

        • 1. Re: Starting a stand alone java application in Jboss as7
          wdfink

          You might have the idea to modify jboss scripts,

          but I recommend to write a wrapper script that start your java application and the JBoss in that order you need.

          • 2. Re: Starting a stand alone java application in Jboss as7
            sgandhi

            Hi Wolf ,

             

            Thanks for the response...I tried writing a shell script (./myscript.sh) containg  ./standalone.sh and my script for eg (./pms_start.sh) ,

             

            ./standalone.sh &

            ./pms_start.sh &

             

            My pms_start.sh just has just this : "java com.XXX.XXX.sampleProg"

             

            and when i start myscript.sh both the jboss server and my application (standalone application) starts in a different JVM....But I want my standalone application to start in the same JVM which JBOSS uses...Is there any entry in Jboss deployment descriptor which i can use to acheive this ?

             

            My intention is to start a standalone program and not an web or enterprise application...My stand alone program will run until it is terminated...and Iam using Jboss as 7....

             

             

             

            Any help would be greatly appreciated...

             

            Thanks,

            SG

            • 3. Re: Starting a stand alone java application in Jboss as7
              rs2715

              Check standalone.conf

              • 4. Re: Starting a stand alone java application in Jboss as7
                wdfink

                No, you can't start a Java standalone application in the same VM as JBoss. JBoss is an application server. (i.e. no IO or GUI allowed)

                You might redesingn your application and deploy it as a timer driven SLSB to do some jobs periodicaly.

                • 5. Re: Starting a stand alone java application in Jboss as7
                  wdfink

                  Hi rs2715,

                   

                  There is no way to start a standalone programm in the same JVM, Java contains no JVM start option to start two Main classes.

                  standalone.conf allow only to set some VM options, or start a new JVM.