Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

query Regarding name not bound exception in EJB3...  RSS feed

Rahul Ba
Ranch Hand
Posts: 212
  • 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:
| +- testQueue (class:
| +- ex (class:
| +- DLQ (class:
| +- D (class:
| +- C (class:
| +- OurSampleQueue (class:
| +- B (class:

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.

Reza Rahman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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,
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!