Issue Details (XML | Word | Printable)

Key: GLASSFISH-18096
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Hong Zhang
Reporter: exabrial
Votes: 0
Watchers: 2

If you were logged in you would be able to see more operations.

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

Created: 29/Dec/11 06:11 PM   Updated: 05/Jan/12 08:25 PM   Resolved: 05/Jan/12 08:25 PM
Component/s: deployment
Affects Version/s: 3.1.1
Fix Version/s: 3.1.2_b17, 4.0

Time Tracking:
Original Estimate: 3 days
Original Estimate - 3 days
Remaining Estimate: 3 days
Remaining Estimate - 3 days
Time Spent: Not Specified
Time Spent - Not Specified

File Attachments: 1. Zip Archive (26 kB) 03/Jan/12 04:06 PM - exabrial


Windows xp x86, JDK6u30, gf v3.1.1

Tags: jca ejb resource injection 3_1_2-approved
Participants: exabrial, Hong Zhang and Jagadish

 Description  « Hide

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:

public class EchoServiceBean implements EchoService {

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:

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:

No work has yet been logged on this issue.