glassfish
  1. glassfish
  2. GLASSFISH-19711

JMS connection factory creation with glassfish-resources.xml not upwardly compatible

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: 4.0_b77
    • Fix Version/s: 4.0
    • Component/s: jms
    • Labels:
      None

      Description

      For GlassFish 4 it seems to have become a requirement that the connector connection pool and the connector resource created for a JMS connection factory must not have the same name, even though they are two different resources.

      I tried to run on GF 4 b77 the following glassfish-resources.xml file, which defines a JMS connection factory as follows:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
      <resources>
      <connector-resource enabled="true" jndi-name="jms/DurableConnectionFactory" object-type="user" pool-name="jms/DurableConnectionFactory">
      <description/>
      </connector-resource>
      <connector-connection-pool associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-definition-name="javax.jms.ConnectionFactory" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="true" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="jms/DurableConnectionFactory" ping="false" pool-resize-quantity="2" pooling="true" resource-adapter-name="jmsra" steady-pool-size="8" validate-atmost-once-period-in-seconds="0">
      <property name="ClientId" value="MyID"/>
      </connector-connection-pool>
      </resources>

      This worked fine in GF 3. However, now I get the following error:

      Unable to create connector resource jms/DurableConnectionFactory. Constraints for this ConnectorResource configuration have been violated: on property [ ] violation reason [

      {resourcename.isnot.unique}

      ]

      The result is that the connector connection pool is created, but the connector resource is not.

      Why should a resource of one type not be able to have the same name as a resource of a different type? This constraint is new and is likely to lead to problems when people port applications from GF 3 to GF 4.

        Activity

        Hide
        Kim Haase added a comment -

        By the way, the DTDs for GlassFish 4 are not yet posted to glassfish.org, so I don't know how to update the DOCTYPE element –

        GlassFish Application Server 3.1 -> GlassFish Application Server 4.0?
        http://glassfish.org/dtds/glassfish-resources_1_5.dtd -> http://glassfish.org/dtds/glassfish-resources_1_6.dtd?

        Show
        Kim Haase added a comment - By the way, the DTDs for GlassFish 4 are not yet posted to glassfish.org, so I don't know how to update the DOCTYPE element – GlassFish Application Server 3.1 -> GlassFish Application Server 4.0? http://glassfish.org/dtds/glassfish-resources_1_5.dtd -> http://glassfish.org/dtds/glassfish-resources_1_6.dtd?
        Hide
        David Zhao added a comment -

        This is by design. A new constraint that no duplicate names are allowed any more was introduced since 4.0, please refer to GLASSFISH-15104 for details.

        ********
        Made changes to support AS-ARCH requirement 'Not to allow two resources by same name, irrespective of the resource-type. All resources part of the domain must have the unique name.'.
        ie., we would not allow a connector-resource and jdbc-resource by same name.

        To support this requirement I added new annotation @UniqueResourceNameConstraint for all resources which validates the resource name is unique across the domain.
        ********

        Please update your glassfish-resources.xml accordingly: Use different names for connector-connection-pool.name and connector-resource.jndi-name.

        BTW, DTD is not able to define such thing (logical constraint for duplicate string) like that.

        Show
        David Zhao added a comment - This is by design. A new constraint that no duplicate names are allowed any more was introduced since 4.0, please refer to GLASSFISH-15104 for details. ******** Made changes to support AS-ARCH requirement 'Not to allow two resources by same name, irrespective of the resource-type. All resources part of the domain must have the unique name.'. ie., we would not allow a connector-resource and jdbc-resource by same name. To support this requirement I added new annotation @UniqueResourceNameConstraint for all resources which validates the resource name is unique across the domain. ******** Please update your glassfish-resources.xml accordingly: Use different names for connector-connection-pool.name and connector-resource.jndi-name. BTW, DTD is not able to define such thing (logical constraint for duplicate string) like that.
        Hide
        Kim Haase added a comment -

        Thanks for this information. I've added a comment to GLASSFISH-15104 about the upward compatibility issue.

        Show
        Kim Haase added a comment - Thanks for this information. I've added a comment to GLASSFISH-15104 about the upward compatibility issue.

          People

          • Assignee:
            David Zhao
            Reporter:
            Kim Haase
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: