can not find jndi name in Weblogic 8.1 sp1 + JB9

2003-10-29 10:28:06 AM
Created a very simple session bean using weblogic 8.1 sp1 in JB9.
The session bean's name is Agent. Here is the exception thrown by
lookup : 'javax.naming.NameNotFoundException: Unable to resolve 'Agent'
Resolved ; remaining name 'Agent'
Following is the source code:
Context context = getInitialContext(); //ok, see source code below
Object ref = context.lookup("Agent"); //error, throw the exception
//look up jndi name and cast to Home interface
agentHome = (AgentHome) PortableRemoteObject.narrow(ref,
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.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ?
"" : password);
return new InitialContext(properties); //successful return
catch(Exception e) {
log("Unable to connect to WebLogic server at " + url);
log("Please make sure that the server is running.");
throw e;
Here is the ejb-jar.xml (part)
Here is the web;pgoc-ejb-jar.xml (part)
Any hint?
I successful built this example under Borland Enterprise Server. But
Weblogic seems to be a different story.
Danny Wang