• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error while running session bean

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
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");
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
System.out.println("after statement initial_context_factory");
p.put(Context.PROVIDER_URL,"t3://localhost:7001");
System.out.println("after statement provider_url");
ctx = new InitialContext(p);
System.out.println("after statement new InitialContext");
try{
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).]
 
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(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\classes;d:\weblogic\lib\weblogicaux.jar;
d:\weblogic\license;d:\weblogic\classes\boot;
d:\weblogic\myserver\clientclasses;
d:\weblogic\myserver\serverclasses weblogic.server;
d:\weblogic\lib\rmiForMs.zip;d:\jdk1.2.2\lib\tools.jar;
d:\jdk1.2.2\lib\classes.zip;
d:\development\work\classes
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
Posts: 919
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic