File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
EJB and other Java EE Technologies
Author
Name comp/ejb not found
M Burke
Ranch Hand
Joined: Jun 25, 2004
Posts: 375
posted
Apr 25, 2005 19:26:00
0
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
posted
Apr 25, 2005 20:25:00
0
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
posted
Apr 26, 2005 06:53:00
0
Hi Burke,
Try java:comp/
env
/ejb.
Regards.
I think, therefore I exist -- Rene Descartes
M Burke
Ranch Hand
Joined: Jun 25, 2004
Posts: 375
posted
Apr 27, 2005 22:12:00
0
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://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Name comp/ejb not found
Similar Threads
inheritance in EJBs
ejb as abstract ?
InitialContext(): setting envirnment variables with a Hashtable
SOS!NameNotFoundException of my HelloWorldejb
EJB Timer issue
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter