• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

NameNotFoundException: 'ordermanagementLocal'

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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) {
try
{
Properties prop=new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL,"t3://localhost:7001");
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");
om.remove();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

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="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>ordermgt</display-name>
<enterprise-beans>
<session>
<display-name>ordermanagementSB</display-name>
<ejb-name>ordermanagementBean</ejb-name>
<local-home>ordermgt.ordermanagementLocalHome</local-home>
<local>ordermgt.ordermanagementLocal</local>
<ejb-class>ordermgt.ordermanagementBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>ordermanagementBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

init:
deps-jar:
Compiling 1 source file to C:\Users\SAM\Documents\NetBeansProjects\ordermanagement\build\jar
compile-single:
run-main:
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(ResponseImpl.java:191)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:315)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:250)
at weblogic.jndi.internal.ServerNamingNode_910_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:374)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:362)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at client.main(client.java:21)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'ordermanagementLocal'. Resolved ''
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1123)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:250)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:204)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403)
at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56)
at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
BUILD SUCCESSFUL (total time: 42 seconds)
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic