-
1. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
jbertram Jun 6, 2016 8:51 AM (in response to ramanasada)It's hard to say with the information you've provided. Can you attach the configuration for server 2 as well as the relevant client code?
-
2. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
ramanasada Jun 10, 2016 5:40 AM (in response to jbertram)Hi,
Thanks for your response, I am not able to attach the files. Below is sample client code.
can you plz let me know how to share the file, bcz I have to share standalone-full-S1.xml,standalone-full-S2.xml
public void send(Properties o) {
Connection connection = null;
Session session = null;
try {
TransportConfiguration transportConfiguration = new TransportConfiguration(
NettyConnectorFactory.class.getName());
.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
Queue queue = HornetQJMSClient.createQueue(DxRConstants.LOCAL_QUEUENAME);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer sender = session.createProducer(queue);
ObjectMessage message = session.createObjectMessage();
message.setObject(o);
sender.send(message);
}
-
3. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
jbertram Jun 10, 2016 10:21 AM (in response to ramanasada)You can click the "Use advanced editor" link near the top right of the comment text box and you will have the option of attaching your files. However, I'm not sure that's necessary now that I see your code. I assume this same bit of code is running on both S1 and S2 instances. If so, then your problem is almost certainly in the way you're configuring your transport. You're specifying the NettyConnectorFactory, but not providing a hostname or port which means the default will be used (i.e. localhost:5445). Since S1 is running on the default ports and S2 is offset that means your client on S2 will actually connect to S1 which is why, I believe, it can't find the expected destination. You could specify the proper port on the transportConfiguration, but I would recommend not using the NettyConnectorFactory at all. I think you should use org.hornetq.core.remoting.impl.invm.InVMConnectorFactory instead which will avoid the overhead of Netty for your connection and will always connect to the HornetQ broker running in the same JVM as your client (which is what you want).
-
4. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
ramanasada Jun 14, 2016 3:04 AM (in response to jbertram)Thank you for your response.I have attached two configuration files.
Regarding hostname and port number, i am reading it from property file and it is my standalone file to test.
o.getProperty(DxRConstants.HOSTNAME)
o.getProperty(DxRConstants.PORT));
Actually i have deployed 2 EAR files with specific queue names(a and a2 sample code below) and using corresponding xml files.
Instance 1 code----------------------------
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/a") })
public class ReceptionServiceReceiver implements MessageListener {
private Logger logger = Logger.getLogger(getClass());
ReceptionServiceImpl serviceClass = new ReceptionServiceImpl();
public void onMessage(Message msg) {
// TODO Auto-generated method stub
Instance 2 code----------------------------
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/a2") })
public class ReceptionServiceReceiver implements MessageListener {
private Logger logger = Logger.getLogger(getClass());
ReceptionServiceImpl serviceClass = new ReceptionServiceImpl();
public void onMessage(Message msg) {
// TODO Auto-generated method stub
Below are the modifications i did in standalone-full-S2.xml file.
1. port-offset="100"
2.Queue names(a2,b2..)
-
standalone-full-S1.xml.zip 3.9 KB
-
standalone-full-S2.xml.zip 3.9 KB
-
-
5. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
jbertram Jun 14, 2016 1:51 PM (in response to ramanasada)Regarding hostname and port number, i am reading it from property file and it is my standalone file to test.
o.getProperty(DxRConstants.HOSTNAME)
o.getProperty(DxRConstants.PORT));
This code is not part of what you pasted previously. Did you leave it out of your previous comment? If so, why? If not, then how does it apply to the code you previously pasted and identified as having an issue?
Actually i have deployed 2 EAR files with specific queue names(a and a2 sample code below) and using corresponding xml files.
Instance 1 code----------------------------
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/a") })
public class ReceptionServiceReceiver implements MessageListener {
private Logger logger = Logger.getLogger(getClass());
ReceptionServiceImpl serviceClass = new ReceptionServiceImpl();
public void onMessage(Message msg) {
// TODO Auto-generated method stub
Instance 2 code----------------------------
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/a2") })
public class ReceptionServiceReceiver implements MessageListener {
private Logger logger = Logger.getLogger(getClass());
ReceptionServiceImpl serviceClass = new ReceptionServiceImpl();
public void onMessage(Message msg) {
// TODO Auto-generated method stub
I don't understand. Are you saying that this code is having trouble too? Please elaborate.
-
6. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
ramanasada Jun 15, 2016 5:11 AM (in response to jbertram)Hi Justin,
Below is my process.
STEP:1
In Standalone2 i am able to read and process the request from X2 queue using below code snippet.
--------------------------------------------------reading from queue--------------------------------------------------------
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/x2") })
public class ReceptionServiceReceiver implements MessageListener {
ReceptionServiceImpl serviceClass = new ReceptionServiceImpl();
public void onMessage(Message msg) {
// TODO Auto-generated method stub--
--------------------------------------------------------------------------------------------------------------------------------------------------
STEP:2
Once request is processed I have to send the message to next Queue(A2) using below code. But the message is not getting posted to the next queue.
try {
TransportConfiguration transportConfiguration = new TransportConfiguration(
NettyConnectorFactory.class.getName());
ConnectionFactory factory = (ConnectionFactory) HornetQJMSClient
.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration);
// Hostname and Port number reading from properties file
svo.setJmsQueueType(serviceClass.getProerpty(ReceptionServiceConstants.JMS_QUEUE));
svo.setQueueName(serviceClass.getProerpty(ReceptionServiceConstants.QUEUE_NAME));
svo.setHostName(serviceClass.getProerpty(ReceptionServiceConstants.HOST_NAME));
svo.setPort(serviceClass.getProerpty(ReceptionServiceConstants.PORT));
queue = HornetQJMSClient.createQueue(svo.getQueueName());
connection = factory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
sender = session.createProducer(queue);
} catch (JMSException exception) {
System.out.println("Error while creating jms connection - "
+ exception); }
I am getting the below exception while executing the above code.
Exception: Error while creating jms connection - javax.jms.InvalidDestinationException: Destination A2 does not exist.
But same code is working for Standalone1. ( The queues are different for standalone 1 and standalone 2). For queue configuration refer the xml attached in my previous comment.
-
7. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
jbertram Jun 15, 2016 9:40 AM (in response to ramanasada)I'm not sure what else to tell you. I already identified what I believe to be the problem a few comments back. None of the information you have provided since then has changed anything. For clarity's sake I'll reiterate.
From all I can see, you simply aren't setting the proper hostname and port on the TransportConfiguration you're using to create your ConnectionFactory. This results in the ConnectionFactory running in S2 connecting to S1 which doesn't have the expected destination deployed. To correct this I recommend you use org.hornetq.core.remoting.impl.invm.InVMConnectorFactory in your TransportConfiguration. Again, I said all this 5 days ago.
The MDB reads from the expected destination because it uses an in-vm connection by default.
-
8. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
ramanasada Jun 23, 2016 2:50 AM (in response to jbertram)Hi Justin,
As you suggested i have replaced NettyConnectorFactory with InVMConnectorFactory, But getting below exception.
I have tried with and with out HOST name and PORT.
javax.jms.JMSException: Failed to create session factory
TransportConfiguration transportConfiguration = new TransportConfiguration(
InVMConnectorFactory.class.getName());
ConnectionFactory factory = (ConnectionFactory) HornetQJMSClient
.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
transportConfiguration);
/*Hashtable env = new Hashtable();
env.put("host", "Actual hostname");
env.put("port","PORT");
TransportConfiguration transportConfiguration = new TransportConfiguration(
InVMConnectorFactory.class.getName(),env);
ConnectionFactory factory = (ConnectionFactory) HornetQJMSClient
.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
transportConfiguration);*/
queue = HornetQJMSClient.createQueue(svo.getQueueName());
connection = factory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
sender = session.createProducer(queue);
-
9. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
jbertram Jun 23, 2016 10:05 AM (in response to ramanasada)Was there a stack-trace associated with the exception that you can share?
-
10. Re: javax.jms.InvalidDestinationException: Destination A2 does not exist.
jbertram Jun 23, 2016 12:26 PM (in response to ramanasada)BTW, host and port are not valid for an in-vm connection since no network connection is involved.