File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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
I agree. Here's the link:
subject: query Regarding name not bound exception in EJB3...
jQuery in Action, 3rd edition