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:
<italics>
javax.naming. NameNotFoundException: SessionBeanHomeRemote not bound
</italics>
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:
<code>
<?xml version="1.0" encoding="UTF-8" ?>
<
jboss>
<enterprise-beans>
<session>
<ejb-name>SessionEJB</ejb-name>
<jndi-name>SessionBeanHomeRemote</jndi-name>
</session>
<entity>
<ejb-name>ProjectTeamEJB</ejb-name>
<jndi-name>ProjectTeamHomeRemote</jndi-name>
<local-jndi-name>ProjectTeamHomeLocal</local-jndi-name>
</entity>
<entity>
<ejb-name>ProjectEJB</ejb-name>
<jndi-name>ProjectTeamHomeRemote</jndi-name>
<local-jndi-name>ProjectHomeLocal</local-jndi-name>
</entity>
</enterprise-beans>
</jboss>
</code>
The client code is as follows:
<code>
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)
{
try
{
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("SessionBeanHomeRemote");
SessionBeanHomeRemote home = (SessionBeanHomeRemote)
PortableRemoteObject.narrow(ref,SessionBeanHomeRemote.class);
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++)
{
System.out.println(list[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 jndi.properties file*/
java.util.Properties p = new java.util.Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES,
"jboss.naming

rg.jnp.interfaces");
p.put(Context.PROVIDER_URL, "localhost:1099");
return new javax.naming.InitialContext(p);
}
}
</code>
All help is appreciated guys!!!