*
The moose likes EJB and other Java EE Technologies and the fly likes Name comp/ejb not found 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 "Name comp/ejb not found " Watch "Name comp/ejb not found " New topic
Author

Name comp/ejb not found

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 382
I get an error "javax.naming.NameNotFoundException: Name comp/ejb not found in context "java:" when I do a lookup. Why would java:comp/ejb not be available?

package sessions;

import java.math.BigDecimal;

import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import entities.ora9EmpLocal;
import entities.ora9EmpLocalHome;
/**
* Bean implementation class for Enterprise Bean: Session1
*/
public class Session1Bean implements javax.ejb.SessionBean {
private javax.ejb.SessionContext mySessionCtx;
/**
* getSessionContext
*/

public void runOra9Emp(int empno){
String jndiName = "java:comp/ejb/ora9EmpLocalHome";
ora9EmpLocalHome oh;
ora9EmpLocal ol;

try {
InitialContext initialContext = new InitialContext();

Object homeObject = initialContext.lookup(jndiName);
oh = (ora9EmpLocalHome) homeObject;
ol = oh.create(new BigDecimal(1000));
ol.setEname("Lalala");
} catch (NamingException e) {

e.printStackTrace();
}catch (CreateException e) {

e.printStackTrace();
}




}


public javax.ejb.SessionContext getSessionContext() {
return mySessionCtx;
}
/**
* setSessionContext
*/
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
}
/**
* ejbCreate
*/
public void ejbCreate() throws javax.ejb.CreateException {
}
/**
* ejbActivate
*/
public void ejbActivate() {
}
/**
* ejbPassivate
*/
public void ejbPassivate() {
}
/**
* ejbRemove
*/
public void ejbRemove() {
}
}
Sreenivasa Majji
Ranch Hand

Joined: Jul 12, 2001
Posts: 224
Checking the JNDI name in your app server.

In web logic you can check this under your server name, view JNDI tree.


Sreenivasa Majji
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Burke,

Try java:comp/env/ejb.
Regards.


I think, therefore I exist -- Rene Descartes
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 382
I tried this...
java:comp/env/ejb/ora9EmpLocalHome

I get "java:comp/env/ejb/ora9EmpLocalHome is not found"

Is there a way to specify what namespace to look for a jndi name?
[ April 27, 2005: Message edited by: M Burke ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Name comp/ejb not found
 
Similar Threads
SOS!NameNotFoundException of my HelloWorldejb
inheritance in EJBs
InitialContext(): setting envirnment variables with a Hashtable
ejb as abstract ?
EJB Timer issue