glassfish
  1. glassfish
  2. GLASSFISH-16938

Glassfish embedded runs JMSRA broker in REMOTE mode regardless of settings

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1.1, 4.0
    • Component/s: ejb_container
    • Labels:
      None
    • Environment:

      all platforms

      Description

      I wrote an unit test which runs an embedded glassfish server and deploy my application on it:

      String glassfishHome = "src/test/glassfish";
      String instanceRoot = glassfishHome + "/domains/some-domain";
      String configFile = instanceRoot + "/config/domain.xml";
      
      Map<String, String> props = new HashMap<String, String>();
      props.put("org.glassfish.ejb.embedded.glassfish.installation.root", installRoot);
      props.put("org.glassfish.ejb.embedded.glassfish.instance.root", instanceRoot);
      props.put("org.glassfish.ejb.embedded.glassfish.configuration.file", configFile);
      props.put(EJBContainer.APP_NAME, "appName");
      
      ejbContainer = EJBContainer.createEJBContainer(props);
      

      The domain.xml file contains (among others) the following configuration:

      <jms-service default-jms-host="default_JMS_host" type="EMBEDDED">
        <jms-host host="localhost" name="default_JMS_host"></jms-host>
      </jms-service>
      

      Everything is OK until my application contains MDB beans. In such situation JMSRA broker is run but in REMOTE mode, what can be seen in logs:

       
      2011-07-01 12:07:53 com.sun.messaging.jms.ra.ResourceAdapter start
      INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version:  4.5  (Build 29-b) Compile:  Wed Feb  9 22:53:30 PST 2011
      2011-07-01 12:07:53 com.sun.messaging.jms.ra.ResourceAdapter start
      INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
      2011-07-01 12:07:53 com.sun.messaging.jms.ra.ResourceAdapter start
      INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE
      

      Because of this mode my MDB beans cannot connect to this remote broker and deployment of the application fails!

      When the same domain.xml file is used in a standalone glassfish installation my application works. JMSRA is run in the propper mode: EMBEDDED.

      Why a glassfish embedded server runs JMSRA broker in REMOTE mode regardless of the setting?

      1. run.log
        6 kB
        Satish Kumar

        Activity

        Hide
        Satish Kumar added a comment -

        We have tried to reproduce this using org.glassfish.embeddable API. Here, MQ is starting correctly in EMBEDDED mode, as specified in the custom domain.xml.

        Attached is the client code from our test run (it uses mdb.war from v3/tests/embedded/maven-plugin). The log file from our test run is attached to this issue.

        -----------------Test.java

        import org.glassfish.embeddable.*;
        import java.io.*;
        public class Test {

        public static void main(String... args) throws Exception

        { BootstrapProperties p1 = new BootstrapProperties(); p1.setInstallRoot(System.getenv("S1AS_HOME")); GlassFishRuntime gfr = GlassFishRuntime.bootstrap(p1); GlassFishProperties p2 = new GlassFishProperties(); p2.setInstanceRoot(System.getenv("S1AS_HOME") + "/domains/domain1"); p2.setConfigFileURI("file://" + System.getenv("S1AS_HOME") + "/domains/domain1/config/domain.xml"); GlassFish gf = gfr.newGlassFish(p2); gf.start(); gf.getCommandRunner().run("create-jms-resource", "--restype=javax.jms.Queue", "--property=imqDestinationName=TestQueue", "jms/TestQueue"); gf.getCommandRunner().run("create-jms-resource", "--restype=javax.jms.QueueConnectionFactory", "jms/TestQueueConnectionFactory"); String appName = gf.getDeployer().deploy(new File("mdb.war")); gf.dispose(); }

        }
        ---------------------

        This issue appears to be specific to the embedded EJB container. Looks like EJBContainer.createContainer is always forcing MQ to start in REMOTE mode. Hence, assigning to Marina...

        Show
        Satish Kumar added a comment - We have tried to reproduce this using org.glassfish.embeddable API. Here, MQ is starting correctly in EMBEDDED mode, as specified in the custom domain.xml. Attached is the client code from our test run (it uses mdb.war from v3/tests/embedded/maven-plugin). The log file from our test run is attached to this issue. -----------------Test.java import org.glassfish.embeddable.*; import java.io.*; public class Test { public static void main(String... args) throws Exception { BootstrapProperties p1 = new BootstrapProperties(); p1.setInstallRoot(System.getenv("S1AS_HOME")); GlassFishRuntime gfr = GlassFishRuntime.bootstrap(p1); GlassFishProperties p2 = new GlassFishProperties(); p2.setInstanceRoot(System.getenv("S1AS_HOME") + "/domains/domain1"); p2.setConfigFileURI("file://" + System.getenv("S1AS_HOME") + "/domains/domain1/config/domain.xml"); GlassFish gf = gfr.newGlassFish(p2); gf.start(); gf.getCommandRunner().run("create-jms-resource", "--restype=javax.jms.Queue", "--property=imqDestinationName=TestQueue", "jms/TestQueue"); gf.getCommandRunner().run("create-jms-resource", "--restype=javax.jms.QueueConnectionFactory", "jms/TestQueueConnectionFactory"); String appName = gf.getDeployer().deploy(new File("mdb.war")); gf.dispose(); } } --------------------- This issue appears to be specific to the embedded EJB container. Looks like EJBContainer.createContainer is always forcing MQ to start in REMOTE mode. Hence, assigning to Marina...
        Hide
        Satish Kumar added a comment -

        Changing component from JMS to ejb container

        Show
        Satish Kumar added a comment - Changing component from JMS to ejb container
        Hide
        marina vatkina added a comment -

        While the fix was made on JMS side, I won't reasign the bug back. In 3.1 MDBs were not supported in embeddable EJB container.

        Show
        marina vatkina added a comment - While the fix was made on JMS side, I won't reasign the bug back. In 3.1 MDBs were not supported in embeddable EJB container.

          People

          • Assignee:
            marina vatkina
            Reporter:
            michal_kozak
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: