Could you show us the complete activemq.xml and the activemq log
please? Are you running the broker using the activemq script?

On 4/19/07, TheKK <[EMAIL PROTECTED]> wrote:

Hi All,


I am basically trying to authenticate users while creating connection using
the Simple Authentication Plugin.

activemq.xml
===============
<plugins>
     <simpleAuthenticationPlugin userGroups="#groups"
userPasswords="#users"/>
 </plugins>



    <!-- Added by KK for Authentication starts -->
    <bean id="users" class="java.util.HashMap">
      <map>
         <entry key="kk" value="abc123"/>
      </map>
    </bean>
    <bean id="groups" class="java.util.HashMap">
       <map>
         <entry key="kk" value="admin"/>
        </map>
  </bean>




Code Snippet
============

public class SimpleProducer {

    private static final org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory
            .getLog(SimpleProducer.class);

     public static void main(String[] args) {
        ConnectionFactory connectionFactory = null;
        Connection connection = null;
        Session session = null;
        Topic topic = null;
        MessageProducer producer = null;
        final int NUM_MSGS=20;


        final String url="tcp://localhost:61616";


                try {
                        connectionFactory = new ActiveMQConnectionFactory(url);
                        log.info("Got ConnectionFactory");

                        connection = 
connectionFactory.createConnection("kk","abc");
                        log.info("Got Connection");

                        session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
                        log.info("Got Session");

                        topic = session.createTopic("eMeterTopic");
                        log.info("Got Destination");

                        producer = session.createProducer(topic);
                        log.info("Got Producer");
                        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

            TextMessage message = session.createTextMessage();

            for (int i = 0; i < NUM_MSGS; i++) {
                message.setText("This is message " + (i + 1));
                log.info("Sending message: " + message.getText());
                Thread.sleep(5000);
                producer.send(message);
            }

            producer.send(session.createMessage());

                } catch (Exception e1) {
                                e1.printStackTrace();

                } finally {
            if (connection != null) {
                try {
                    connection.close();
                }
                catch (JMSException e) {
                }
            }
        }
    }
}



While running the SimpleProducer application,with wrong credentials it does
not throw any exception like user is invalid or user is not authtenticated.


So,Please let me know the correct steps to configure Simple Authentication
Plugin in apache-activemq-4.1.1.

Thanks in advance,
KK
--
View this message in context: 
http://www.nabble.com/Configure-Simple-Authentication-Plugin-in-apache-activemq-4.1.1-tf3607805s2354.html#a10080142
Sent from the ActiveMQ - User mailing list archive at Nabble.com.




--
James
-------
http://macstrac.blogspot.com/

Reply via email to