[GLASSFISH-19442]  @JMSConnectionFactoryDefinition ignores clientId attribute Created: 14/Dec/12  Updated: 16/Jan/13  Resolved: 16/Jan/13

Status: Resolved
Project: glassfish
Component/s: jms
Affects Version/s: 4.0_b47
Fix Version/s: 4.0_b71

Type: Bug Priority: Major
Reporter: Nigel Deakin Assignee: Simon Meng
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: jms-2-implementation

 Description   

If I define a JMS connection factory using the following annotation:

@JMSConnectionFactoryDefinition(
    name="java:global/jms/demoConnectionFactory",
    className= "javax.jms.ConnectionFactory",
    description="ConnectionFactory to use in demonstration",
    clientId="myClientID",
    resourceAdapterName="jmsra",
    user="guest",
    password="guest"
)  

then inject it into my session bean using:

    @Resource(lookup = "java:global/jms/demoConnectionFactory")
    ConnectionFactory connectionFactory;

use it to create a connection

Connection connection = connectionFactory.createConnection();

and then report the clientid

String clientId = connection.getClientID();
System.out.println("ClientID = "+clientId);

I get a value of null printed,

However if I change the annotation to

@JMSConnectionFactoryDefinition(
    name="java:global/jms/demoConnectionFactory",
    className= "javax.jms.ConnectionFactory",
    description="ConnectionFactory to use in demonstration",
    properties="clientId=myClientID",
    resourceAdapterName="jmsra",
    user="guest",
    password="guest"
)     

then the correct clientId is displayed.

Both ways to configure clientId should work.



 Comments   
Comment by Simon Meng [ 04/Jan/13 ]
@JMSConnectionFactoryDefinition(
    name="java:global/jms/demoConnectionFactory",
    className= "javax.jms.ConnectionFactory",
    description="ConnectionFactory to use in demonstration",
    clientId="myClientIDAttribute",
    properties="clientId=myClientIDProperty",
    resourceAdapterName="jmsra",
    user="guest",
    password="guest"
)    

If clientId is defined in both annotation attribute and property list, which one takes effect?

Comment by Nigel Deakin [ 04/Jan/13 ]

I would suggest processing the "properties" attribute after the other attributes.

Comment by Simon Meng [ 05/Jan/13 ]

Fixed at revision 57972.

Comment by saradak [ 11/Jan/13 ]

Reopening the bug as test is still failing with latest glassfish build(b-71)after the fix.

CTS test(Client_checkClientIDOnDurableConnFactoryTest) failed at getting client id that is defined in the annotation for the
connection factory. This fixed the descriptor version but not the annotation version.

-Sarada

Comment by Simon Meng [ 11/Jan/13 ]

getClientID works fine with the reporter provide sample.
How to get the CTS code and run it? I need check the failed case.

Comment by Simon Meng [ 16/Jan/13 ]

@JMSConnectionFactoryDefinition works fine. The root cause is in MQ, relative bug is MQ-270.

Generated at Sat Jul 04 23:36:10 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.