The moose likes EJB and other Java EE Technologies and the fly likes JNDI problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JNDI problem" Watch "JNDI problem" New topic

JNDI problem

Jan Tsui

Joined: Dec 27, 2003
Posts: 2
I am using JBuilder 9 and Weblogic 8.1.
When I run a EJB client, the NameNotFoundException is triggered when it perform context lookup. Please help!
The code is as following:
try {
Context context = getInitialContext();
Object ref = context.lookup("abc");
loginHome = (LoginHome) PortableRemoteObject.narrow(ref, LoginHome.class);
catch(Exception e) {
if (logging) {
log("Failed initializing bean access.");
private Context getInitialContext() throws Exception {
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
return new InitialContext(properties);
catch(Exception e) {
log("Unable to connect to WebLogic server at " + url);
log("Please make sure that the server is running.");
throw e;
The ejb-jar.xml is as following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<description />
The weblogic-ejb-jar.xml is as following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
Jan Tsui

Joined: Dec 27, 2003
Posts: 2
I have solved such stupid question.
I haven't deploy the EJB first, I just run the server and client application.
I agree. Here's the link: http://aspose.com/file-tools
subject: JNDI problem
Similar Threads
DataSource in ejb-jar.xml
Problem with CMT on Stateless Session beans
using connection pool in EJb
Context Lookup Failing
how to devlop and deploy EJB