• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javax.naming. NameNotFoundException:

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
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
 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Infyniti
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:



...it 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.

Cheers,
Jason
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic