| Author |
error initializing ord
|
aj cec
Greenhorn
Joined: Feb 05, 2004
Posts: 2
|
|
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.
|
 |
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
|
|
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
|
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
|
 |
aj cec
Greenhorn
Joined: Feb 05, 2004
Posts: 2
|
|
|
thanks =) ill look into it.
|
 |
 |
|
|
subject: error initializing ord
|
|
|