glassfish
  1. glassfish
  2. GLASSFISH-18819

Glassfish/mq dosen't work normally after setting the port of mq broker into "0"

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 4.0_b41
    • Fix Version/s: 4.1
    • Component/s: jms
    • Labels:
      None
    • Environment:

      Windows Xp

      Description

      [Bug Description]
      Glassfish/mq dosen't work normally after setting the port of mq broker into "0"

      [Operations]
      1、Setting the port of mq broker by executing "%GF_HOME%\mq\bin\imqbrokerd -port 0"
      Note:%GF_HOME% is Glassfish v4 Install Directory.

      2、After executing "%GF_HOME%\mq\bin\imqcmd list svc -b localhost:0", the following error
      message appeared.

      ----------------------------------------------------------------------------
      Warming: [C4003]: Error occurred on connection creation [localhost:0]. - cause: jav
      a.net.ConnectException: connect: Address is invalid on local machine, or port is
      not valid on remote machine
      Error while connecting to the broker on host 'localhost' and port '0'.
      com.sun.messaging.jms.JMSException: [C4003]: Error occurred on connection creati
      on [localhost:0]. - cause: java.net.ConnectException: connect: Address is invali
      d on local machine, or port is not valid on remote machine
      Please verify that there is a broker running on the specified host and port or
      use the '-b' option to specify the correct broker host and port.
      ----------------------------------------------------------------------------

      [My Suggestion]
      I think that firstly, mq should not allow setting the port of mq broker as "0", secondly,when user
      sets the port of mq broker as "0", mq should give a error message, for example,

      "[B4027]: Invalid property value: port=0" in the admin-console

      [Affected versions ]
      1 4.0_b42
      2 gf's trunk until 2012/06/21

        Activity

        Hide
        David Zhao added a comment -

        Created MQ-321 for it because it is MQ issue instead of GlassFish issue.

        Show
        David Zhao added a comment - Created MQ-321 for it because it is MQ issue instead of GlassFish issue.
        Hide
        TangYong added a comment -

        Now, mq trunk source seemed not to be checkouted , I also want to know how to checkout the mq trunk source nowaday.

        Show
        TangYong added a comment - Now, mq trunk source seemed not to be checkouted , I also want to know how to checkout the mq trunk source nowaday.
        Hide
        Jeremy_Lv added a comment - - edited

        This issue is occurred in glassfish v4.0_b41,however, it's related to the component of mq.
        The revised the code as follows:

        [Source Directory]
        mq-broker\broker-core\src\main\java\com\sun\messaging\jmq\jmsserver\Broker.java

        [Diff]
        mq-broker\broker-core\src\main\java\com\sun\messaging\jmq\jmsserver\Broker.java
        ===================================================================
        @@ -1486,13 +1486,20 @@

        • if (++n >= args.length)
          + if (++n >= args.length)
          throw new IllegalArgumentException("missing port");
          + try { + checkCmdPortValue( args[n] ); + }

          + catch ( IllegalArgumentException e )

          { + printErr( e.getMessage() ); + throw e; + }

        @@ -2317,4 +2324,19 @@
        "#topic.create.allow.user=*\n" +
        "##############################################\n";
        +
        + private void checkCmdPortValue( String p ) {
        + // port range check
        + if ( p != null ) {
        + try {
        + int port = Integer.parseInt(p);
        + if ( ( port <= 0 ) || ( 65535 < port ) )

        { + throw new IllegalArgumentException( rb.getKString(rb.X_BAD_PROPERTY_VALUE, "port=" + p)); + }

        + } catch (NumberFormatException e)

        { + throw new IllegalArgumentException( rb.getKString(rb.X_BAD_PROPERTY_VALUE, "port=" + p)); + }

        + }
        + }
        +

        [Revised Version]
        <mq.version>5.0-002</mq.version>

        I have uploaded my revised java file to the attachment.

        Show
        Jeremy_Lv added a comment - - edited This issue is occurred in glassfish v4.0_b41,however, it's related to the component of mq. The revised the code as follows: [Source Directory] mq-broker\broker-core\src\main\java\com\sun\messaging\jmq\jmsserver\Broker.java [Diff] mq-broker\broker-core\src\main\java\com\sun\messaging\jmq\jmsserver\Broker.java =================================================================== @@ -1486,13 +1486,20 @@ if (++n >= args.length) + if (++n >= args.length) throw new IllegalArgumentException("missing port"); + try { + checkCmdPortValue( args[n] ); + } + catch ( IllegalArgumentException e ) { + printErr( e.getMessage() ); + throw e; + } @@ -2317,4 +2324,19 @@ "#topic.create.allow.user=*\n" + "##############################################\n"; + + private void checkCmdPortValue( String p ) { + // port range check + if ( p != null ) { + try { + int port = Integer.parseInt(p); + if ( ( port <= 0 ) || ( 65535 < port ) ) { + throw new IllegalArgumentException( rb.getKString(rb.X_BAD_PROPERTY_VALUE, "port=" + p)); + } + } catch (NumberFormatException e) { + throw new IllegalArgumentException( rb.getKString(rb.X_BAD_PROPERTY_VALUE, "port=" + p)); + } + } + } + [Revised Version] <mq.version>5.0-002</mq.version> I have uploaded my revised java file to the attachment.

          People

          • Assignee:
            David Zhao
            Reporter:
            Jeremy_Lv
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: