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_b17, 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

        No work has yet been logged on this issue.

          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