glassfish
  1. glassfish
  2. GLASSFISH-18096

GlassFish ignores @Resource(authenticationType = AuthenticationType.CONTAINER) if no ejb-jar.xml is present in an EJB

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.2_dev, 4.0
    • Component/s: deployment
    • Labels:
      None
    • Environment:

      Windows xp x86, JDK6u30, gf v3.1.1

      Description

      Summary: GlassFish ignores @Resource(authenticationType = AuthenticationType.CONTAINER) if no ejb-jar.xml is present in an EJB

      Setup: When creating a Connnector Connection Pool, GF has a Security Maps tab. Enter the following:

      Principal: *
      Backend Principal: uid/password

      Create an EJB with an injection point:

      @Stateless
      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
      public class EchoServiceBean implements EchoService {

      @Resource(
      name = "view/EchoService",
      type = ViewManagerClientFactory.class,
      authenticationType = AuthenticationType.CONTAINER)
      ViewManagerClientFactory clientFactory;

      GlassFish will not pass the backend principal to the @Resource.

      To make this work, put the same information in the ejb-jar.xml:
      <session>
      <ejb-name>EchoServiceBean</ejb-name>
      <resource-ref>
      <res-ref-name>view/EchoService</res-ref-name>
      <res-type>com.argushealth.enterprise.viewmanager.ViewManagerClientFactory</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      </session>

      The problem is in ConnectionManagerImpl. It uses pure XML to determine whether or not container managed authentication is required:

      if (ref == null) {

      if(getLogger().isLoggable(Level.FINE))

      { getLogger().log(Level.FINE, "poolmgr.no_resource_reference", jndiNameToUse); }

      return internalGetConnection(mcf, defaultPrin, cxRequestInfo,

      resourceShareable, jndiNameToUse, conn, true);

      }

      String auth = ref.getAuthorization();

      This should also examine the @Resource annotation, rather than just doing a null-check if a the resource reference descriptor is null.

      More info: http://www.java.net/forum/topic/glassfish/glassfish/gf-bug-getting-empty-credentials-jca-adapter

        Activity

        exabrial created issue -
        Jagadish made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Invalid [ 6 ]
        Jagadish made changes -
        Resolution Invalid [ 6 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        exabrial made changes -
        Attachment glassfish-jca-problem.zip [ 48788 ]
        Hong Zhang made changes -
        Tags jca ejb resource injection jca ejb resource injection 3_1_2-review
        Joe Di Pol made changes -
        Fix Version/s 3.1.2_b17 [ 15331 ]
        Tags jca ejb resource injection 3_1_2-review jca ejb resource injection 3_1_2-approved
        Hong Zhang made changes -
        Assignee Jagadish [ jr158900 ] Hong Zhang [ hzhang_jn ]
        Fix Version/s 3.1.2_b17 [ 15331 ]
        Tags jca ejb resource injection 3_1_2-approved jca ejb resource injection 3_1_2-review
        Component/s deployment [ 10594 ]
        Component/s jca [ 10602 ]
        Joe Di Pol made changes -
        Fix Version/s 3.1.2_b17 [ 15331 ]
        Tags jca ejb resource injection 3_1_2-review jca ejb resource injection 3_1_2-approved
        Hong Zhang made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Fix Version/s 4.0 [ 10970 ]
        Resolution Fixed [ 1 ]
        Joe Di Pol made changes -
        Fix Version/s 3.1.2_dev [ 17782 ]

          People

          • Assignee:
            Hong Zhang
            Reporter:
            exabrial
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 days
              3d
              Remaining:
              Remaining Estimate - 3 days
              3d
              Logged:
              Time Spent - Not Specified
              Not Specified