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 NameNotFoundException: 'ordermanagementLocal' 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 "NameNotFoundException: Watch "NameNotFoundException: New topic

NameNotFoundException: 'ordermanagementLocal'


Joined: Mar 14, 2008
Posts: 1
dear all,

i'm writing stateless bean program and error is occuring: code and error is as follows

import ordermgt.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.*;
public class client {

/** Creates a new instance of client */
public client() {

* @param args the command line arguments
public static void main(String[] args) {
Properties prop=new Properties();
Context ctx=new InitialContext(prop);
Object objref=ctx.lookup("ordermanagementLocal");
ordermanagementLocalHome home=(ordermanagementLocalHome)javax.rmi.PortableRemoteObject.narrow(objref,ordermanagementLocalHome.class);
ordermanagementLocal om=home.create();
om.placeorder("sudhir ","nut");
catch(Exception e)

package ordermgt;

import javax.ejb.EJBLocalObject;

* This is the local interface for ordermanagement enterprise bean.
public interface ordermanagementLocal extends EJBLocalObject, ordermanagementLocalBusiness {
void placeorder(String custname,String prodname) throws java.rmi.RemoteException;


package ordermgt;

import javax.ejb.*;

* This is the bean class for the ordermanagementBean enterprise bean.
* Created Mar 10, 2008 3:54:01 PM
* @author Administrator
public class ordermanagementBean implements SessionBean, ordermanagementLocalBusiness {
private SessionContext context;

// <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click the + sign on the left to edit the code.">
// TODO Add code to acquire and use other enterprise resources (DataSource, JMS, enterprise bean, Web services)
// TODO Add business methods or web service operations
* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
public void setSessionContext(SessionContext aContext) {
context = aContext;

* @see javax.ejb.SessionBean#ejbActivate()
public void ejbActivate() {


* @see javax.ejb.SessionBean#ejbPassivate()
public void ejbPassivate() {


* @see javax.ejb.SessionBean#ejbRemove()
public void ejbRemove() {

// </editor-fold>
public void placeorder(String custname, String prodname)
System.out.println("order get from custname"+custname+" for product "+prodname);
* See section 7.10.3 of the EJB 2.0 specification
* See section 7.11.3 of the EJB 2.1 specification
public void ejbCreate() {
// TODO implement ejbCreate if necessary, acquire resources
// This method has access to the JNDI context so resource aquisition
// spanning all methods can be performed here such as home interfaces
// and data sources.

// Add business logic below. (Right-click in editor and choose
// "EJB Methods > Add Business Method" or "Web Service > Add Operation")


package ordermgt;

* This is the business interface for ordermanagement enterprise bean.
public interface ordermanagementLocalBusiness {


package ordermgt;

import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;

* This is the local-home interface for ordermanagement enterprise bean.
public interface ordermanagementLocalHome extends EJBLocalHome {

ordermanagementLocal create() throws CreateException;


<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="2.1" xmlns="" xmlns:xsi="" xsi:schemaLocation="">

Compiling 1 source file to C:\Users\SAM\Documents\NetBeansProjects\ordermanagement\build\jar
javax.naming.NameNotFoundException: Unable to resolve 'ordermanagementLocal'. Resolved '' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'ordermanagementLocal'. Resolved '']; remaining name 'ordermanagementLocal'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(
at weblogic.jndi.internal.ServerNamingNode_910_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(
at weblogic.jndi.internal.WLContextImpl.lookup(
at javax.naming.InitialContext.lookup(
at client.main(
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'ordermanagementLocal'. Resolved ''
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(
at weblogic.jndi.internal.BasicNamingNode.lookupHere(
at weblogic.jndi.internal.ServerNamingNode.lookupHere(
at weblogic.jndi.internal.BasicNamingNode.lookup(
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(
at weblogic.rmi.cluster.ClusterableServerRef.invoke(
at weblogic.rmi.internal.BasicServerRef$
at weblogic.rmi.internal.BasicServerRef.handleRequest(
at weblogic.rmi.internal.BasicServerRef.access$300(
at weblogic.rmi.internal.BasicServerRef$
BUILD SUCCESSFUL (total time: 42 seconds)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Your client looks remote, but is trying to access an EJB which exposes local interfaces. If you do have a remote client, then the EJB must expose remote interfaces. Sort this out first. There are still other things which don't look right, but let's take things a step at a time.

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Shashi Ranjan

Joined: Jun 12, 2007
Posts: 8
I think you are doing mistake in looking up a JNDI for remote interface whereas your component interface and home interface are Local. It might be a problem...try to sort it out..
I agree. Here's the link:
subject: NameNotFoundException: 'ordermanagementLocal'
It's not a secret anymore!