Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query Regarding name not bound exception in EJB3...

 
Rahul Ba
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a question.I am writing simple program in ejb3 which send message from client and consumer is MDB.After deploying in JBoss, startup time I get the message....Name not bound exception. for OurSampleQueue

Here is my sample client code while looking up:

qconFactory = (QueueConnectionFactory) ctx.lookup("jms/connectionFactory");

connection = qconFactory.createQueueConnection();
session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

queue = (Queue) ctx.lookup("queue/OurSampleQueue");
msg = session.createTextMessage();

sender = session.createSender(queue);

Here is the MDB code sample:

@MessageDriven(name="LongProcessMessageBean", activationConfig = {
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination", propertyValue="queue/OurSampleQueue")

})

Now here is the JNDI tree view of JBoss:
this is snap of Global namespace.

+- queue (class: org.jnp.interfaces.NamingContext)
| +- A (class: org.jboss.mq.SpyQueue)
| +- testQueue (class: org.jboss.mq.SpyQueue)
| +- ex (class: org.jboss.mq.SpyQueue)
| +- DLQ (class: org.jboss.mq.SpyQueue)
| +- D (class: org.jboss.mq.SpyQueue)
| +- C (class: org.jboss.mq.SpyQueue)
| +- OurSampleQueue (class: org.jboss.mq.SpyQueue)
| +- B (class: org.jboss.mq.SpyQueue)


Now my question is after successul bound of the name (Which can be seen in JNDI tree view) why we get the name not bound exception.
Please explain me in detail. Thanks in advance.

Regards,
Rahul.
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul,

Unfortunately, I don't have a lot of time for detail, but I can give you some pointers to look into:

1. If the client code is in Java SE, you might be connecting to the wrong JNDI context (seems unlikely in this case, but worth checking).
2. From your code snippet, it seems like 'jms/ConnectionFactory' is not bound. This is more likely since JBoss does not bind JMS resources to 'jms/...' by default. The more likely JNDI name is just 'ConnectionFactory'.

Best regards,
Reza
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic