aspose file tools
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 Head First Android this week in the Android 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" "">
<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
It's not a secret anymore!