This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes query Regarding name not bound exception in EJB3...    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "query Regarding name not bound exception in EJB3...    " Watch "query Regarding name not bound exception in EJB3...    " New topic

query Regarding name not bound exception in EJB3...

Rahul Ba
Ranch Hand

Joined: Oct 01, 2008
Posts: 206
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

Joined: Feb 01, 2005
Posts: 580

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,

Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
Have you checked out Aspose?
subject: query Regarding name not bound exception in EJB3...
It's not a secret anymore!