3 Replies Latest reply on Jul 31, 2013 5:26 AM by Andrew Dinn

    How to use Byteman with Glassfish v2 in production environment?

    Rogerio Canashiro Newbie

      Hi,

       

      I'd like to use Byteman in a Glassfish v2 application server, in production environment. Are there any guides/tutorials about it?

       

      Thank you.

        • 1. Re: How to use Byteman with Glassfish v2 in production environment?
          Andrew Dinn Master

          H Rogerio,

          I'd like to use Byteman in a Glassfish v2 application server, in production environment. Are there any guides/tutorials about it?

           

          Thank you.

           

          I don't know of any special actions needed to make Byteman work in Glassfish which don't also apply to any other Java program. So, if you want to use Byteman in Glassfish then I suggest you simply read the first Byteman tutorial and follow the instructions it provides for installing and running the byteman agent. It explains how to install the agent and, optionally, your byteman scripts from the java command line using the -javaagent argument to the java command. It also explains how to install the agent  into a running deployment using the bminstall bin script and how to upload your rules into a running deployment using bin script bmsubmit.

           

          If you have any problems getting this to work please reply with more details and I will do what I can to help you overcome them.

           

          regards

           

           

          Andrew Dinn

          • 2. Re: How to use Byteman with Glassfish v2 in production environment?
            Rogerio Canashiro Newbie

            Hi Andrew,

             

            I'm trying to use bminstall with the following command:

            bminstall -p 8080 -h myserver.mydomain.com 6859

             

             

            The 6859 pid I got from typing "ps -aux" in the console from the glassfish app server, at the line it shows

            /usr/local/jdk1.6.0_18/bin/java -Dcom.sun.aas.instanceRoot=/www/javaee/domains/domain1 -Dcom.sun.aas.ClassPathPrefix=/www/javaee/domains/domain1/lib/*.jar

             

             

            I'm getting the following error when trying to use bminstall:

            com.sun.tools.attach.AttachNotSupportedException: Unable to attach to 32-bit pro

            cess running under WOW64

             

            Am I doing something wrong?

            • 3. Re: How to use Byteman with Glassfish v2 in production environment?
              Andrew Dinn Master

              Hi Rogerio,

              Rogerio Canashiro wrote:

               

              I'm trying to use bminstall with the following command:

              bminstall -p 8080 -h myserver.mydomain.com 6859

               

               

              The 6859 pid I got from typing "ps -aux" in the console from the glassfish app server, at the line it shows

              /usr/local/jdk1.6.0_18/bin/java -Dcom.sun.aas.instanceRoot=/www/javaee/domains/domain1 -Dcom.sun.aas.ClassPathPrefix=/www/javaee/domains/domain1/lib/*.jar

               

               

              I'm getting the following error when trying to use bminstall:

              com.sun.tools.attach.AttachNotSupportedException: Unable to attach to 32-bit pro

              cess running under WOW64

               

              Am I doing something wrong?

              Hmm, "32-bit process"? "WOW64"?

               

              It looks to me like you have installed a 32-bit Java VM on a 64-bit Windows operating system and, hence, are executing Glassfish on this JVM using the compatibility mode provided by WOW64 (Windows 32-bit on Windows 64-bit). Evidently the attach operation employed by class VM_Attach to install the agent cannot tolerate this.

               

              I am not surprised by this. Loading the agent requires that the JVM started by script bminstall establishes a memory segment shared with the JVM running Glassfish. I don't doubt that opening up a slab of virtual address space to another process (whether or not it might also be running in compatibility mode) is something the WOW64 compatibility layer cannot safely countenance.

               

              If this is the problem then I suggest you either run your 32-bit JVM on a 32-bit Windows OS or install a 64-bit windows JVM on your current 64 bit Windows OS.