• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

error initializing ord

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone help. I have this code. I am using Websphere v5.1
public class EjbUtils {

public static Context getInitialContext()throws NamingException{
Hashtable hash = new Hashtable();
hash.put (Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
hash.put(Context.PROVIDER_URL,"iiop://localhost/9080");
return new InitialContext(hash);
}
______
public class JndiExplorer {
public static void main(String args[]){
Context ctx = null;
try{
ctx = EjbUtils.getInitialContext();
bindTestObject(ctx);
listBindings("",ctx);
}catch(Exception e){
e.printStackTrace();
}

}

private static void bindTestObject(Context context)throws NamingException{
List testBinding = new LinkedList();
testBinding.add("bound string");
testBinding.add(new Integer(2));
context.bind("test binding",testBinding);
}

private static void listBindings(String name,Context context)throws NamingException{
NamingEnumeration bindings = null;
String fullName = null;
try{
bindings = context.listBindings(name);
}catch(CannotProceedException e){
return;
}catch(Exception e){
return;
}
while(bindings.hasMore()){
NameClassPair binding = (NameClassPair)bindings.next();
fullName = name.equals("") ? binding.getName() : name + "." + binding.getName();
System.out.println("\r\nJNDI name : '" + fullName + "'");
}
try{
Object boundObject = context.lookup(fullName);
System.out.println("bound object toString == '" + boundObject + "'");
}catch(Exception e){
e.printStackTrace();
}
}
}
it displays an error:
javax.naming.NamingException: Failed to initialize the ORB. Root exception is java.lang.ClassNotFoundException: com.ibm.ejs.oa.EJSORB
at java.net.URLClassLoader.findClass(URLClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:516)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:441)
at java.lang.ClassLoader.loadClass(ClassLoader.java:448)
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java:142)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:266)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:364)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)
at com.ibm.ws.naming.util.WsnInitCtx.bind(WsnInitCtx.java:151)
at javax.naming.InitialContext.bind(InitialContext.java:367)
at JndiExplorer.bindTestObject(JndiExplorer.java:36)
at JndiExplorer.main(JndiExplorer.java:24)
I have already included naming.jar (where the WsnInitialContextFactory is) and namingclient.jar (where the jndiproperties.properties is).
What seems to be the problem? thank you.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read the parts of the infocenter that describe the "j2ee client" and "launchClient.bat" carefully. You can't just put random jars on your classpath and hope to make a WebSphere client program work. There's a special set of steps for this.
Kyle
 
aj cec
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks =) ill look into it.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic