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
Operations

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

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 glassfish-jca-problem.zip (26 kB) 03/Jan/12 04:06 PM - exabrial

Environment:

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:

@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



No work has yet been logged on this issue.