You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by JAkub Scholz <sc...@scholzj.com> on 2009/09/10 20:38:59 UTC

JMS, ACL and connecting to existing exchange/queue

Hi,

I have a qpid broker with all exchanges and queues predefined and with ACL
limiting users only to publish messages to specific exchanges and consume
messages from specific queues.

Now I want to write a small client application written in Java using JMS
which should connect to a exchange/queue specified in properties file and
sent/retrieve messages. Unfortunately, although the exchanges and queues I
want to connect to are already created, my client app always fails with
exception "not-allowed: ACL denied exhange declare request ...". According
to the broker log, the application wants to create a new exchange instead of
connect to existing exchange. If I turn off the ACL or give create
permissions for the exchange/queue to the user I'm connecting with
everything is working fine.

The same problem appears also with the example JMS applications provided
with qpid.

Is there any possibility to connect to existing exchanges/queues with JMS
without trying to create the destinations?

Thanks for any kind of help

Regards
JAkub

Re: JMS, ACL and connecting to existing exchange/queue

Posted by Rajith Attapattu <ra...@gmail.com>.
Hello Jakub,

You actually found a bug. The MessageProducer impl does create an
exchange in its constructor but does not check the
"qpid.declare_exchanges" system property.
I will fix this and commit tomorrow morning. That should take care of
your problem.

Regards,

Rajith

On Wed, Sep 23, 2009 at 2:13 PM, JAkub Scholz <sc...@scholzj.com> wrote:
> Hi Rajith,
>
> Thanks for your help. Unfortunately, it helped only partially. With these
> properties I'm able to create the producer and the consumer/listener. It
> seems, that the consumer/listener needs also access privileges for the
> exchange to be able to receive some messages.
>
> But the problem is in the message producer. I'm able to create the
> MessageProducer instance, but when I try to send some messages (using the
> send method of MessageProducer instance), it is still trying to declare the
> exchange instead just publishing a message to existing exchange  and I get
> again the same error "not-allowed: ACL denied exhange declare request from
> ..."
>
> run:
> 23.09.2009 20:06:17 org.apache.qpid.jndi.PropertiesFileInitialContextFactory
> getInitialContext
> INFO: No Provider URL specified.
> 23.09.2009 20:06:17 org.apache.qpid.client.AMQConnection <init>
> INFO:
> Connection:amqp://********:********@TestClient/********?brokerlist='tcp://********:********
> 23.09.2009 20:06:17 org.apache.qpid.transport.util.Logger warn
> WARNUNG: Ignoring the idle timeout 0 set by the connection, using the
> brokers max value 120
> 23.09.2009 20:06:18 org.apache.qpid.client.BasicMessageProducer
> setPublishMode
> INFO: MessageProducer
> org.apache.qpid.client.BasicMessageProducer_0_10@1a06e38 using publish mode
> : ASYNC_PUBLISH_ALL
> org.apache.qpid.transport.SessionException: ch=0 id=0
> ExecutionException(errorCode=NOT_ALLOWED, commandId=0, classCode=7,
> commandCode=1, fieldIndex=0, description=not-allowed: ACL denied exhange
> declare request from eurex@QPID18787 (qpid/broker/SessionAdapter.cpp:73),
> errorInfo={})
>    at org.apache.qpid.transport.Session.invoke(Session.java:543)
>    at
> org.apache.qpid.transport.SessionInvoker.messageTransfer(SessionInvoker.java:96)
>    at
> org.apache.qpid.client.BasicMessageProducer_0_10.sendMessage(BasicMessageProducer_0_10.java:166)
>    at
> org.apache.qpid.client.BasicMessageProducer.sendImpl(BasicMessageProducer.java:489)
>    at
> org.apache.qpid.client.BasicMessageProducer.sendImpl(BasicMessageProducer.java:444)
>    at
> org.apache.qpid.client.BasicMessageProducer.send(BasicMessageProducer.java:313)
>    at JMSProducer.runProducer(JMSProducer.java:72)
>    at JMSProducer.main(JMSProducer.java:31)
> Caught an Exception: javax.jms.JMSException: Exception when sending message
>
>
> Regards
> JAkub
>
>
>
>
> On Thu, Sep 10, 2009 at 9:43 PM, Rajith Attapattu <ra...@gmail.com>wrote:
>
>> Hello Jakub,
>>
>> By default, the Qpid JMS client creates exchanges and queues.
>> You can use -Dqpid.declare_exchanges=false and
>> -Dqpid.declare_queues=false to turn off this behaviour.
>> That should do what you are looking for.
>>
>> Regards,
>>
>> Rajith
>>
>> On Thu, Sep 10, 2009 at 2:38 PM, JAkub Scholz <sc...@scholzj.com> wrote:
>> > Hi,
>> >
>> > I have a qpid broker with all exchanges and queues predefined and with
>> ACL
>> > limiting users only to publish messages to specific exchanges and consume
>> > messages from specific queues.
>> >
>> > Now I want to write a small client application written in Java using JMS
>> > which should connect to a exchange/queue specified in properties file and
>> > sent/retrieve messages. Unfortunately, although the exchanges and queues
>> I
>> > want to connect to are already created, my client app always fails with
>> > exception "not-allowed: ACL denied exhange declare request ...".
>> According
>> > to the broker log, the application wants to create a new exchange instead
>> of
>> > connect to existing exchange. If I turn off the ACL or give create
>> > permissions for the exchange/queue to the user I'm connecting with
>> > everything is working fine.
>> >
>> > The same problem appears also with the example JMS applications provided
>> > with qpid.
>> >
>> > Is there any possibility to connect to existing exchanges/queues with JMS
>> > without trying to create the destinations?
>> >
>> > Thanks for any kind of help
>> >
>> > Regards
>> > JAkub
>> >
>>
>>
>>
>> --
>> Regards,
>>
>> Rajith Attapattu
>> Red Hat
>> http://rajith.2rlabs.com/
>>
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project:      http://qpid.apache.org
>> Use/Interact: mailto:users-subscribe@qpid.apache.org
>>
>>
>



-- 
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/

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


Re: JMS, ACL and connecting to existing exchange/queue

Posted by JAkub Scholz <sc...@scholzj.com>.
Hi Rajith,

Thanks for your help. Unfortunately, it helped only partially. With these
properties I'm able to create the producer and the consumer/listener. It
seems, that the consumer/listener needs also access privileges for the
exchange to be able to receive some messages.

But the problem is in the message producer. I'm able to create the
MessageProducer instance, but when I try to send some messages (using the
send method of MessageProducer instance), it is still trying to declare the
exchange instead just publishing a message to existing exchange  and I get
again the same error "not-allowed: ACL denied exhange declare request from
..."

run:
23.09.2009 20:06:17 org.apache.qpid.jndi.PropertiesFileInitialContextFactory
getInitialContext
INFO: No Provider URL specified.
23.09.2009 20:06:17 org.apache.qpid.client.AMQConnection <init>
INFO:
Connection:amqp://********:********@TestClient/********?brokerlist='tcp://********:********
23.09.2009 20:06:17 org.apache.qpid.transport.util.Logger warn
WARNUNG: Ignoring the idle timeout 0 set by the connection, using the
brokers max value 120
23.09.2009 20:06:18 org.apache.qpid.client.BasicMessageProducer
setPublishMode
INFO: MessageProducer
org.apache.qpid.client.BasicMessageProducer_0_10@1a06e38 using publish mode
: ASYNC_PUBLISH_ALL
org.apache.qpid.transport.SessionException: ch=0 id=0
ExecutionException(errorCode=NOT_ALLOWED, commandId=0, classCode=7,
commandCode=1, fieldIndex=0, description=not-allowed: ACL denied exhange
declare request from eurex@QPID18787 (qpid/broker/SessionAdapter.cpp:73),
errorInfo={})
    at org.apache.qpid.transport.Session.invoke(Session.java:543)
    at
org.apache.qpid.transport.SessionInvoker.messageTransfer(SessionInvoker.java:96)
    at
org.apache.qpid.client.BasicMessageProducer_0_10.sendMessage(BasicMessageProducer_0_10.java:166)
    at
org.apache.qpid.client.BasicMessageProducer.sendImpl(BasicMessageProducer.java:489)
    at
org.apache.qpid.client.BasicMessageProducer.sendImpl(BasicMessageProducer.java:444)
    at
org.apache.qpid.client.BasicMessageProducer.send(BasicMessageProducer.java:313)
    at JMSProducer.runProducer(JMSProducer.java:72)
    at JMSProducer.main(JMSProducer.java:31)
Caught an Exception: javax.jms.JMSException: Exception when sending message


Regards
JAkub




On Thu, Sep 10, 2009 at 9:43 PM, Rajith Attapattu <ra...@gmail.com>wrote:

> Hello Jakub,
>
> By default, the Qpid JMS client creates exchanges and queues.
> You can use -Dqpid.declare_exchanges=false and
> -Dqpid.declare_queues=false to turn off this behaviour.
> That should do what you are looking for.
>
> Regards,
>
> Rajith
>
> On Thu, Sep 10, 2009 at 2:38 PM, JAkub Scholz <sc...@scholzj.com> wrote:
> > Hi,
> >
> > I have a qpid broker with all exchanges and queues predefined and with
> ACL
> > limiting users only to publish messages to specific exchanges and consume
> > messages from specific queues.
> >
> > Now I want to write a small client application written in Java using JMS
> > which should connect to a exchange/queue specified in properties file and
> > sent/retrieve messages. Unfortunately, although the exchanges and queues
> I
> > want to connect to are already created, my client app always fails with
> > exception "not-allowed: ACL denied exhange declare request ...".
> According
> > to the broker log, the application wants to create a new exchange instead
> of
> > connect to existing exchange. If I turn off the ACL or give create
> > permissions for the exchange/queue to the user I'm connecting with
> > everything is working fine.
> >
> > The same problem appears also with the example JMS applications provided
> > with qpid.
> >
> > Is there any possibility to connect to existing exchanges/queues with JMS
> > without trying to create the destinations?
> >
> > Thanks for any kind of help
> >
> > Regards
> > JAkub
> >
>
>
>
> --
> Regards,
>
> Rajith Attapattu
> Red Hat
> http://rajith.2rlabs.com/
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

Re: JMS, ACL and connecting to existing exchange/queue

Posted by Rajith Attapattu <ra...@gmail.com>.
Hello Jakub,

By default, the Qpid JMS client creates exchanges and queues.
You can use -Dqpid.declare_exchanges=false and
-Dqpid.declare_queues=false to turn off this behaviour.
That should do what you are looking for.

Regards,

Rajith

On Thu, Sep 10, 2009 at 2:38 PM, JAkub Scholz <sc...@scholzj.com> wrote:
> Hi,
>
> I have a qpid broker with all exchanges and queues predefined and with ACL
> limiting users only to publish messages to specific exchanges and consume
> messages from specific queues.
>
> Now I want to write a small client application written in Java using JMS
> which should connect to a exchange/queue specified in properties file and
> sent/retrieve messages. Unfortunately, although the exchanges and queues I
> want to connect to are already created, my client app always fails with
> exception "not-allowed: ACL denied exhange declare request ...". According
> to the broker log, the application wants to create a new exchange instead of
> connect to existing exchange. If I turn off the ACL or give create
> permissions for the exchange/queue to the user I'm connecting with
> everything is working fine.
>
> The same problem appears also with the example JMS applications provided
> with qpid.
>
> Is there any possibility to connect to existing exchanges/queues with JMS
> without trying to create the destinations?
>
> Thanks for any kind of help
>
> Regards
> JAkub
>



-- 
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/

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