wood burning stoves*
The moose likes BEA/Weblogic and the fly likes error while running session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "error while running session bean" Watch "error while running session bean" New topic

error while running session bean

Rishi K

Joined: Oct 04, 2000
Posts: 1
I get the following error when I try to access a session bean through a client program:
java.lang.NoClassDefFoundError: javax/naming/InitialContext
The part of code that gives the error is:
public Object doLookup(String homeObject,String homeClass) throws NamingException,RemoteException{
Context ctx = null;
Object obj = null;
Properties p = new Properties();
System.out.println("inside method doLookup");
System.out.println("after statement initial_context_factory");
System.out.println("after statement provider_url");
ctx = new InitialContext(p);
System.out.println("after statement new InitialContext");
obj = javax.rmi.PortableRemoteObject.narrow(ctx.lookup(homeObject),Class.forName(homeClass));
}catch(ClassNotFoundException e){
throw new RemoteException("Session "+e.getMessage());
}catch(Exception e){
throw new RemoteException("Session Exception "+e.getMessage());
return obj;
The jar files(one session and one entity) have been created and installed on the weblogic server without any problem.
The import statements are:
import javax.naming.*;
import java.rmi.*;
import java.util.Hashtable;
import java.util.Properties;
The statement where the error comes is:
ctx = new InitialContext(p);
I am using weblogic 5.1.0 and jdk1.2.2.
Can anybody help?
[This message has been edited by Rishi K (edited October 04, 2000).]
George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
please would you post the contents of your JAVACLASSPATH, WEBLOGICCLASSPATH and weblogic.class.path when this error happens?
also, can you say whether you have the most up-to-date service pack? (if not, it is downloadable from BEA)
Rishi Upadhyay

Joined: Oct 05, 2000
Posts: 6
(I had to change my userid,looks like it doesnt follow the norms of the site)
My CLASSPATH is set as follows:
(everything is installed in d drive and development\work\classes in classpath is the package where i am working ie d:\development\work\classes\com\xxxx\....)

d:\weblogic\myserver\serverclasses weblogic.server;
I dont have any weblogic class path explicitly set.As far as I know only CLASSPATH settings would be enough to run applications.
Also I have created the jar files using the 'build' file that comes with weblogic examples.The deployertool was not working for some reason.I have an evaluation copy right now.
George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
for info, when you start weblogic server using scripts on NT, an argument is passed to the invocation of the JVM, which takes the form "-Dweblogic.class.path=%WEBLOGIC_CLASSPATH%". Make sure that when that command is executed the WEBLOGIC_CLASSPATH environment variable includes the path to weblogicaux.jar
It certainly looks like a classpath problem.
have you tried downloading a service pack? I'm sure they work on eval copies too.
Rishi Upadhyay

Joined: Oct 05, 2000
Posts: 6
Thanks for the inputs.I did download the latest service pack ,but before that I reset my classpath and weblogic.class.path using wlconfig.exe command in weblogic/bin and it worked!!So I wont install the service pack.Thanks again
Don't get me started about those stupid light bulbs.
subject: error while running session bean