Hi Tim,

Yes, you are correct. Once I started using setClientId, it has given me 
exception.

Thanks Tim.

Thanks & Regards
Suneel

-----Original Message-----
From: Timothy Bish [mailto:tabish...@gmail.com] 
Sent: 18 April 2011 20:22
To: users@activemq.apache.org
Subject: Re: No Errors at ActiveMQ-CPP client for wrong credentials.

On Mon, 2011-04-18 at 14:31 +0100, Suneel Papineni wrote:
> Hi,
> 
>  
> 
> I am using ActiveMQ-CPP 3.2.5 and ActiveMQ 5.5. An application is
> designed using this and is connected successfully with correct
> credentials. When I pass wrong credentials, I didn't receive any error
> message at client-side. Only at ActiveMQ logs, it is shown as a warning.
> 
>  
> 
> "WARN | Failed to add Connection ID:SuneelP-M6500-53700-1303-0:0,
> reason: java.lang.SecurityException: User name or password is invalid."
> 
>  
> 
> Following is the code I am using....
> 
> try {
> 
> activemq::library::ActiveMQCPP::initializeLibrary();
> 
>       auto_ptr<ConnectionFactory>
> connectionFactory(ConnectionFactory::createCMSConnectionFactory("tcp://l
> ocalhost:61616")); 
> 
>       connection =
> connectionFactory->createConnection("system","password");  //Wrong
> Credentials
> 
>       connection->setExceptionListener(this);
> 
> }catch (CMSException cmsexp) {
> 
>       std::cout << cmsexp.getMessage();
> 
> }     
> 

Have you tried adding in a call to start or any other connection method
after the setExceptionListener call, the connection doesn't necessarily
send the connection info data to the broker until you do something with
it, its waiting in order to allow a call to setClientId to be applied
before starting the connection handshake.

>  
> 
> Could you please let me know if I need to modify or add anything else to
> get error at client for wrong credentials.

> 
> Also, is there any way to know at client side if ActiveMQ is started and
> running properly, before creating a connection with ActiveMQ.
> 

Not really.

Regards


-- 
Tim Bish
------------
FuseSource
Email: tim.b...@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/

Connect at CamelOne May 24-26

The Open Source Integration Conference

Reply via email to