You are on page 1of 3

// Student.java import java.io.

Serializable; public class Student implements Serializable { String name; int htno; String address; public void setName(String name) { this.name = name; } public String getName() { return name; } public void setHtno(int htno) { this.htno = htno; } public int getHtno() { return htno; } public void setAddress(String address) { this.address = address; } public String getAddress() { return address; } } // StoreObject.java import javax.naming.Context; import javax.naming.InitialContext; import java.util.Hashtable; import javax.naming.NamingException; public class StoreObject { public static void main(String[] args) { Context ctx = null; Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT _FACTORY,"weblogic.jndi.WLInit ialContextFactory"); ht.put(Context.PROVIDER_URL,"t 3://localhost:7001"); ht.put(Context.SECURITY_PRINCI PAL,"admin"); ht.put(Context.SECURITY_CREDEN TIALS,"inetsolv1"); Student s = new Student(); s.setName("JAVA ANAND"); s.setHtno(1); s.setAddress("Banglore"); try { ctx = new InitialContext(ht); ctx.bind("student",s); } catch(NamingException ne) { ne.printStackTrace(); } finally { if(ctx != null) { try { ctx.close(); } catch(NamingException ne) { ne.printStackTrace(); }

} } } } When am running the StoreObject.java program am getting the InitialContext object,but the problem is with bind() method and i set the CLASSPATH to jar file which provide implementation to JNDI API (wlclient.jar).When am persist student object am getting the following runtime exception. javax.naming.NamingException: Unhandled exception in bind() [Root exception is rg.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No] at weblogic.corba.j2ee.naming.Uti ls.wrapNamingException(Utils.j ava:83) at weblogic.corba.j2ee.naming.Con textImpl.bind(ContextImpl.java :345) at weblogic.corba.j2ee.naming.Con textImpl.bind(ContextImpl.java :302) at javax.naming.InitialContext.bi nd(Unknown Source) at StoreObject.main(StoreObject.j ava:20) Caused by: org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No at sun.reflect.NativeConstructorA ccessorImpl.newInstance0(Nativ e Method at sun.reflect.NativeConstructorA ccessorImpl.newInstance(Unknow n Source at sun.reflect.DelegatingConstruc torAccessorImpl.newInstance(Un known So rce) at java.lang.reflect.Constructor. newInstance(Unknown Source) at java.lang.Class.newInstance0(U nknown Source) at java.lang.Class.newInstance(Un known Source) at com.sun.corba.se.impl.protocol .giopmsgheaders.MessageBase.ge tSystemE ception(Unknown Source) at com.sun.corba.se.impl.protocol .giopmsgheaders.ReplyMessage_1 _2.getSy temException(Unknown Source) at com.sun.corba.se.impl.protocol .CorbaMessageMediatorImpl.getS ystemExc ptionReply(Unknown Source) at com.sun.corba.se.impl.protocol .CorbaClientRequestDispatcherI mpl.proc ssResponse(Unknown Source) at com.sun.corba.se.impl.protocol .CorbaClientRequestDispatcherI mpl.mars alingComplete(Unknown Source)

at com.sun.corba.se.impl.protocol .CorbaClientDelegateImpl.invok e(Unknow Source) at org.omg.CORBA.portable.ObjectI mpl._invoke(Unknown Source) at weblogic.corba.cos.naming._Nam ingContextAnyStub.bind_any(_Na mingCont xtAnyStub.java:21) at weblogic.corba.j2ee.naming.Con textImpl.bind(ContextImpl.java :331) ... 3 more

You might also like