H i everyone! i'm trying to made a message queue with hornetQ in
JBOSS AS 7.1.1 with eclipse but i have always the same exception:
Exception in
thread "main" javax.jms.JMSSecurityException: Unable to validate user: dave
at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:312)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:780)
at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:279)
at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:601)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:684)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(HornetQConnectionFactory.java:119)
at com.wettpunkt.shopApp.beans.Sender.<init>(Sender.java:27)
at com.wettpunkt.shopApp.beans.Sender.main(Sender.java:50)
Caused by: HornetQException[errorCode=105 message=Unable to validate user: dave]
I don't understand why because i have all the configuration ok, i think...
My steeps:
-I added the user dave as guest with the add-user. bat tool.
-I modified in JBOSS 7 standalone-full.xml with this lines:
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/test"/>
<entry name="java:jboss/exported/jms/queue/test"/>
</jms-queue>
<jms-queue name="PlayQueue">
<entry name="queue/PlayQueue"/>
<entry name="java:jboss/exported/jms/queue/PlayQueue"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test"/>
<entry name="java:jboss/exported/jms/topic/test"/>
</jms-topic>
</jms-destinations>
-I runned JBOSS7 with standalone-full.xml
-I made one sender class with a main method and after jboss server starts, i run this main class.
This is the class:
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.NamingException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
public class Sender {
private final ConnectionFactory cf;
private final Connection c;
private final Session s;
private final Destination d;
private final MessageProducer mp;
public Sender() throws NamingException, JMSException {
TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName());
cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration);
c = cf.createConnection("dave", "mustaine");
d = HornetQJMSClient.createQueue("PlayQueue");
this.s = this.c.createSession(false, Session.AUTO_ACKNOWLEDGE);
this.c.start();
this.mp = this.s.createProducer(this.d);
}
private void send(
String string) throws JMSException {
TextMessage tm = this.s.createTextMessage(string);
this.mp.send(tm);
}
private void close() throws JMSException {
this.c.close();
}
/**
* @param args
* @throws JMSException
* @throws NamingException
*/
public static void main(String[] args) throws NamingException, JMSException {
Sender s = new Sender();
s.send("Ola ca estou eu!");
s.close();
}
}
Help me please!! Thankssss