You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Praveen Murugesan (Created) (JIRA)" <ji...@apache.org> on 2012/02/07 02:42:59 UTC

[jira] [Created] (QPID-3817) QueueBrowser does not work with the JNDI destination addressing scheme

QueueBrowser does not work with the JNDI destination addressing scheme
----------------------------------------------------------------------

                 Key: QPID-3817
                 URL: https://issues.apache.org/jira/browse/QPID-3817
             Project: Qpid
          Issue Type: Bug
          Components: Java Broker
    Affects Versions: 0.15
            Reporter: Praveen Murugesan


I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)

A sample code snippet is below; (just to give an idea).

Properties properties = new Properties();
String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
properties.put("destination.T1", queueAddress);
InitialContext ctx = new InitialContext(properties);
Destination queue = (Destination) ctx.lookup(queueName);

QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);

triggers =>
java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)

The createBrowser call is part of JMS. However this part of the API cannot
be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3817) QueueBrowser does not work with the JNDI destination addressing scheme

Posted by "Praveen Murugesan (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Praveen Murugesan updated QPID-3817:
------------------------------------

    Attachment: QueueBrowserPatch.patch

Patch to fix the createBrowser cast exception when trying to create a queue browser with a destination object created using JNDI initialization
                
> QueueBrowser does not work with the JNDI destination addressing scheme
> ----------------------------------------------------------------------
>
>                 Key: QPID-3817
>                 URL: https://issues.apache.org/jira/browse/QPID-3817
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.15
>            Reporter: Praveen Murugesan
>              Labels: create, jndi, queue
>             Fix For: 0.15
>
>         Attachments: QueueBrowserPatch.patch
>
>
> I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> A sample code snippet is below; (just to give an idea).
> Properties properties = new Properties();
> String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
> properties.put("destination.T1", queueAddress);
> InitialContext ctx = new InitialContext(properties);
> Destination queue = (Destination) ctx.lookup(queueName);
> QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
> triggers =>
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> The createBrowser call is part of JMS. However this part of the API cannot
> be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3817) QueueBrowser creation does not work with Address syntax via 'destination.' entries in JNDI properties files

Posted by "Robbie Gemmell (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robbie Gemmell updated QPID-3817:
---------------------------------

    Summary: QueueBrowser creation does not work with Address syntax via 'destination.' entries in JNDI properties files  (was: QueueBrowser does not work with the JNDI destination addressing scheme)
    
> QueueBrowser creation does not work with Address syntax via 'destination.' entries in JNDI properties files
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-3817
>                 URL: https://issues.apache.org/jira/browse/QPID-3817
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.15
>            Reporter: Praveen Murugesan
>            Assignee: Robbie Gemmell
>              Labels: create, jndi, queue
>             Fix For: 0.15
>
>         Attachments: QueueBrowserPatch.patch
>
>
> I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> A sample code snippet is below; (just to give an idea).
> Properties properties = new Properties();
> String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
> properties.put("destination.T1", queueAddress);
> InitialContext ctx = new InitialContext(properties);
> Destination queue = (Destination) ctx.lookup(queueName);
> QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
> triggers =>
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> The createBrowser call is part of JMS. However this part of the API cannot
> be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3817) QueueBrowser does not work with the JNDI destination addressing scheme

Posted by "Praveen Murugesan (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Praveen Murugesan updated QPID-3817:
------------------------------------


Patch Attached

Cause: When creating a QueueBrowser with a destination created using an addressing string a java.lang.ClassCastException is thrown. 

Consequence: The application is unable to create QueueBrowser from destinations created using an addressing string. The workaround was to create a Queue using session.createQueue method passing an address string.

Fix: The createBrowser method has been modified to avoid doing the unnecessary cast to AMQQueue object, as this doesn't work with the AMQAnyDestination object created by the jndi queue creation model. The code is now modified to work with the javax.jms.Queue interface instead of the concrete implementation.

Result: The createBrowser method is now able to create a QueueBrowser from a destination created using an address string(if it implements the Queue Interface).

Longer term, it might be nicer to deprecate the older addressing scheme, and stick to the new one. Also, it will be nicer to have a common queue creation code, not a separate path, when created using jndi, and when created using session.createQueue(). Since I'm newer to this project I don't have great expertise, about the reason to different models. It'd be great if someone can throw some light about this.

Thank you.
                
> QueueBrowser does not work with the JNDI destination addressing scheme
> ----------------------------------------------------------------------
>
>                 Key: QPID-3817
>                 URL: https://issues.apache.org/jira/browse/QPID-3817
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.15
>            Reporter: Praveen Murugesan
>              Labels: create, jndi, queue
>             Fix For: 0.15
>
>         Attachments: QueueBrowserPatch.patch
>
>
> I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> A sample code snippet is below; (just to give an idea).
> Properties properties = new Properties();
> String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
> properties.put("destination.T1", queueAddress);
> InitialContext ctx = new InitialContext(properties);
> Destination queue = (Destination) ctx.lookup(queueName);
> QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
> triggers =>
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> The createBrowser call is part of JMS. However this part of the API cannot
> be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Updated] (QPID-3817) QueueBrowser does not work with the JNDI destination addressing scheme

Posted by "Praveen Murugesan (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Praveen Murugesan updated QPID-3817:
------------------------------------

    Fix Version/s: 0.15
    
> QueueBrowser does not work with the JNDI destination addressing scheme
> ----------------------------------------------------------------------
>
>                 Key: QPID-3817
>                 URL: https://issues.apache.org/jira/browse/QPID-3817
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.15
>            Reporter: Praveen Murugesan
>              Labels: create, jndi, queue
>             Fix For: 0.15
>
>         Attachments: QueueBrowserPatch.patch
>
>
> I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> A sample code snippet is below; (just to give an idea).
> Properties properties = new Properties();
> String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
> properties.put("destination.T1", queueAddress);
> InitialContext ctx = new InitialContext(properties);
> Destination queue = (Destination) ctx.lookup(queueName);
> QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
> triggers =>
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> The createBrowser call is part of JMS. However this part of the API cannot
> be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Commented] (QPID-3817) QueueBrowser does not work with the JNDI destination addressing scheme

Posted by "Robbie Gemmell (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206610#comment-13206610 ] 

Robbie Gemmell commented on QPID-3817:
--------------------------------------

Hi Praveen,

Given how long this bug seems to have been present, its funny that this is the second time I have discussed it in the last couple weeks hehe. Rajith had spotted it recently and mentioned he is working on some changes to the Destination handling, so I suggested I'd prefer to wait for those changes for a proper fix (the destination heirarchy is really more at fault than the QueueBrowser code is, though its wrong too) than just make a quick change to get it working seeing as there is a workaround (using 'queue.' entries in the JNDI file) and noone had noticed it in all that time (until you did :P). Your change is nice and small though so I have applied it.

I can't really comment on the seperate paths for creating queues as I didnt write it and haven't had all that much reason to cross paths with it, but I agree having a single path (a factory, perhaps) seems like it would be an obvious approach. We arent likely to deprecate the older addressing scheme any time soon for the existing client, its the only format currnetly supported for the older protocol versions and there are what you might say large numbers of users still depending on it. Work should soon be underway on our client for AMQP 1.0 though, which is intended to be seperate from the current client to let us start afresh with a different design and include such breaks with the past.
                
> QueueBrowser does not work with the JNDI destination addressing scheme
> ----------------------------------------------------------------------
>
>                 Key: QPID-3817
>                 URL: https://issues.apache.org/jira/browse/QPID-3817
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.15
>            Reporter: Praveen Murugesan
>              Labels: create, jndi, queue
>             Fix For: 0.15
>
>         Attachments: QueueBrowserPatch.patch
>
>
> I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> A sample code snippet is below; (just to give an idea).
> Properties properties = new Properties();
> String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
> properties.put("destination.T1", queueAddress);
> InitialContext ctx = new InitialContext(properties);
> Destination queue = (Destination) ctx.lookup(queueName);
> QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
> triggers =>
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> The createBrowser call is part of JMS. However this part of the API cannot
> be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Assigned] (QPID-3817) QueueBrowser does not work with the JNDI destination addressing scheme

Posted by "Robbie Gemmell (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robbie Gemmell reassigned QPID-3817:
------------------------------------

    Assignee: Robbie Gemmell
    
> QueueBrowser does not work with the JNDI destination addressing scheme
> ----------------------------------------------------------------------
>
>                 Key: QPID-3817
>                 URL: https://issues.apache.org/jira/browse/QPID-3817
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.15
>            Reporter: Praveen Murugesan
>            Assignee: Robbie Gemmell
>              Labels: create, jndi, queue
>             Fix For: 0.15
>
>         Attachments: QueueBrowserPatch.patch
>
>
> I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> A sample code snippet is below; (just to give an idea).
> Properties properties = new Properties();
> String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
> properties.put("destination.T1", queueAddress);
> InitialContext ctx = new InitialContext(properties);
> Destination queue = (Destination) ctx.lookup(queueName);
> QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
> triggers =>
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> The createBrowser call is part of JMS. However this part of the API cannot
> be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] [Resolved] (QPID-3817) QueueBrowser does not work with the JNDI destination addressing scheme

Posted by "Robbie Gemmell (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-3817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robbie Gemmell resolved QPID-3817.
----------------------------------

    Resolution: Fixed

Resolving, patch applied.
                
> QueueBrowser does not work with the JNDI destination addressing scheme
> ----------------------------------------------------------------------
>
>                 Key: QPID-3817
>                 URL: https://issues.apache.org/jira/browse/QPID-3817
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.15
>            Reporter: Praveen Murugesan
>            Assignee: Robbie Gemmell
>              Labels: create, jndi, queue
>             Fix For: 0.15
>
>         Attachments: QueueBrowserPatch.patch
>
>
> I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> A sample code snippet is below; (just to give an idea).
> Properties properties = new Properties();
> String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
> properties.put("destination.T1", queueAddress);
> InitialContext ctx = new InitialContext(properties);
> Destination queue = (Destination) ctx.lookup(queueName);
> QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
> triggers =>
> java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
> 	at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
> The createBrowser call is part of JMS. However this part of the API cannot
> be used with Destinations defined using the addressing scheme.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org