File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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" "">
<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' ''>
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:
subject: JNDI problem
Similar Threads
using connection pool in EJb
how to devlop and deploy EJB
Context Lookup Failing
Problem with CMT on Stateless Session beans
DataSource in ejb-jar.xml