• 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

Name comp/ejb not found

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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() {
}
}
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Checking the JNDI name in your app server.

In web logic you can check this under your server name, view JNDI tree.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Burke,

Try java:comp/env/ejb.
Regards.
 
M Burke
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic