The problem is that you're using different broker name brokerDefault, which
will create a new embedded broker instead of using the one you created
earlier named brokerexample

Regards
--
Dejan Bosanac
----------------------
Red Hat, Inc.
FuseSource is now part of Red Hat
dbosa...@redhat.com
Twitter: @dejanb
Blog: http://sensatic.net
ActiveMQ in Action: http://www.manning.com/snyder/


On Tue, Jul 2, 2013 at 7:16 AM, loganathan <logu.i...@gmail.com> wrote:

> Thanks for your response dejan.Below is the code for checking whether the
> configured vm broker url in context_activemq.xml(see first post) is working
> or not.even if i am giving wrong username and password its connecting its
> not showing any exception as "invalid username" Is the below code is
> correct
> for checking vm broker url?can you help me for this?
>
> public class ExampleCheck {
>
>         private static final org.apache.commons.logging.Log log =
> org.apache.commons.logging.LogFactory
>                         .getLog(ExampleCheck.class);
>
>         public static void main(String[] args) {
>                 ConnectionFactory connectionFactory = null;
>                 Connection connection = null;
>                 Session session = null;
>                 Queue queue = null;
>                 MessageProducer producer = null;
>                 final int NUM_MSGS = 20;
>
>
>                 try {
>                         connectionFactory = new
> ActiveMQConnectionFactory("vm://brokerDefault");
>                         log.info("Got ConnectionFactory");
>
>                         connection =
> connectionFactory.createConnection("aaaaaaaa", "pass");
>                         log.info("Got Connection");
>
>                         session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>                         log.info("Got Session");
>
>                         queue =
> session.createQueue("jms:queue:Testsubscription1.outbound.queue");
>                         log.info("Got Destination");
>
>                         producer = session.createProducer(queue);
>                         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) {
>                                 }
>                         }
>                 }
>         }
> }
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Is-simpleauthentication-required-for-vm-broker-url-in-activemq-tp4668721p4668773.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to