On Thu, 2010-05-20 at 02:21 -0700, jolly.Wang wrote:
> the version : ActiveMQ 5.3.0, activemq-cpp 3.1.0
>
> When I use a c++ client to connect the broker, the broker got these
> exceptions:
>
> ---------------------------------------------------------------------------------------------
>
> java.lang.SecurityException: User name or password is invalid.
> at
> org.apache.activemq.security.JaasAuthenticationBroker.addConnection(JaasAuthenticationBroker.java:83)
> at
> org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:82)
> at
> org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:89)
> at
> org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:666)
> at
> org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:83)
> at
> org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:134)
> at
> org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:297)
> at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:175)
> at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
> at
> org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
> at
> org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:210)
> at
> org.apache.activemq.transport.TransportLogger.onCommand(TransportLogger.java:114)
> at
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> at
> org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:203)
> at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
> at java.lang.Thread.run(Unknown Source)
>
> ---------------------------------------------------------------------------------------------
>
> but when i use the same username and password in a JMS client, that
> situation is ok!
>
> the activemq.xml's main part as following:
>
> ----------------------------------------------------------------------------------
> <transportConnectors>
> <transportConnector name="openwire"
> uri="tcp://172.20.2.21:61616?trace=true"/>
> </transportConnectors>
>
> <jaasAuthenticationPlugin configuration="activemq-domain" />
>
> <authorizationPlugin>
> <map>
> <authorizationMap>
> <authorizationEntries>
> <authorizationEntry topic=">" read="admins" write="admins"
> admin="admins" />
> <authorizationEntry queue=">" read="admins" write="admins"
> admin="admins" />
> </authorizationEntries>
> </authorizationMap>
> </map>
> </authorizationPlugin>
>
> ----------------------------------------------------------------------------------
>
> cms::Connection* ActiveMQConnectionFactory::createConnection(
> const std::string& username,
> const std::string& password )
> throw ( cms::CMSException )
>
> ----------------------------------------------------------------------------------
> bool AMQClient::connectBroker(const string& uri, const string& username,
> const string& password)
> {
> try{
> auto_ptr<ConnectionFactory> connectionFactory(
> ConnectionFactory::createCMSConnectionFactory(uri) );
> connection = connectionFactory->createConnection(username,
> password);
> ...
>
> calls like this:
> connection = connectionFactory->createConnection("admin", "hello");
> ------------------------------------------------------------------------------------------------
>
> Does activemq-cpp's ConnectionFactory::createConnection() support JAAS
> authentication, or I use a activemq-cpp in a wrong way? Thanks a lot!!
AFAIK it should work, I'd suggest you try the latest release of AMQCPP
3.1.2 and if that doesn't work then open an issue and attach a test case
and broker config.
Regards
Tim.
--
Tim Bish
Open Source Integration: http://fusesource.com
ActiveMQ in Action: http://www.manning.com/snyder/
Follow me on Twitter: http://twitter.com/tabish121
My Blog: http://timbish.blogspot.com/