The moose likes JBoss/WildFly and the fly likes javax.naming. NameNotFoundException: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "javax.naming. NameNotFoundException:" Watch "javax.naming. NameNotFoundException:" New topic

javax.naming. NameNotFoundException:

Johnny Geller

Joined: Jan 03, 2005
Posts: 1
Alright guys I am trying to run a client from JBuilder to look up a session bean but for some reason I keep getting the error:

javax.naming. NameNotFoundException: SessionBeanHomeRemote not bound

I have checked my jndi name in the deployment descriptor and the lookup from the client and they look fine although I have posted both below ni case a more experienced eye can see an error:

The deployment descriptor is as follows:

<?xml version="1.0" encoding="UTF-8" ?>




The client code is as follows:

package ejbassignment;

import ejbassignment.SessionBeanHomeRemote;
import ejbassignment.SessionBeanRemote;

import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.ejb.CreateException;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;

public class Client
//not right but okay for now
public static String PROJECTTEAM_ID = "1";
public static String MANAGER_ID = "1";

public static void main(String []args)
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("SessionBeanHomeRemote");
SessionBeanHomeRemote home = (SessionBeanHomeRemote)

SessionBeanRemote sessionBean = home.create();

//Get a list of all the Projects for Project Team 1
String list [] = sessionBean.listProjectTeams(PROJECTTEAM_ID, MANAGER_ID);

for(int i = 0; i < list.length; i++)
catch(java.rmi.RemoteException re){re.printStackTrace();}
catch(Throwable t){t.printStackTrace();}

public static Context getInitialContext()
throws javax.naming.NamingException
//return neew InitialContext();
/****context initialised by file*/
java.util.Properties p = new java.util.Properties();
"jboss.naming rg.jnp.interfaces");
p.put(Context.PROVIDER_URL, "localhost:1099");
return new javax.naming.InitialContext(p);

All help is appreciated guys!!!
Olivier Champion

Joined: Feb 11, 2005
Posts: 1
do you find a solution for this error. I am running into the same trouble with an acces from a bean to an ejb session.
Any help would be great
Anant Rao
Ranch Hand

Joined: Nov 12, 2004
Posts: 126
hello guys,
I hope you found solution for javax.naming.NameNotFoundException: eis/jdbc/ejbbank._CMP error. I am running into the same trouble while I acces cmp from universal test client
Any help would be great

thanks in advanace
Jason Mowat
Ranch Hand

Joined: Aug 17, 2003
Posts: 79
I am having a similar problem.

It appears that the beans are being deployed to java:comp/env/your_custom_jndi_context, but the initial context lookup doesn't seem to recognize the custom context you specify. Furthermore, if you "alias" your deployed beans, the alias cannot be found during the lookup.

What I found that works is that you can always refer to the remote bean's component interface. For example, I have an EmployeeFacadeBean with an ejb-name of EmployeeFacade. In jboss.xml, I give it the jndi-name of ejb/EmployeeConsole (my alias). I expect the following to work from a remote client:

JBoss spits back a exception.

However, if I change the code to: works fine.

I'm a little baffled by this. I have no idea why my beans are not binding to java:comp/env/ejb/{my JNDI name}. I suspect jboss.xml, but it looks syntactically correct to me.

Hope that helps this thread out a bit! FWIW, I'm quite new to JBoss.

Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
Hi Johnny,
See the jmx-console, and make sure that your EJB is bound in the JNDI tree. You can see the bound JNDI name of your bean in either jmx-console or web-console of the JBoss server.
I agree. Here's the link:
subject: javax.naming. NameNotFoundException:
It's not a secret anymore!