• Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI rebind - not reflecting changes  RSS feed

 
Babji Reddy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I setup two servers (JVMs). First server does the
InitialContext ctx = new InitialContext();
ctx.bind("foo", "bar");

and goes to a while loop and does lookup on the same name,

From the second server, I do the lookup using new InitialContext(props) obtain the string from lookup, modify the string and issue
ctx.rebind(newStr).

I expect this will be picked up in the new JVM. But its always getting the original value not the modified one.

Any help in this regard??
Thanks
 
Andreas Schaefer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside an Application Server you should not use new InitialContext(Properties) because that can lead to problems. You should use the "corbaname" JNDI context instead:

corbaname:iiop:host ort#a/b/name

(found on http://docs.sun.com/source/819-0079/dgjndi.html)

The second point is that you use ctx.rebind(String) which does not exists.

-Andy
 
Babji Reddy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andreas
the method used to rebind is rebind(name,newObj). That was a typo.
Now, I added to web.xml (WSAD)
<resource-ref id="ResourceRef_1143168486209">
<res-ref-name>myDomainObj</res-ref-name>
<res-type>com.xxx.yyy.MyObj</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
with JNDI ref as corbaname:iiop://babji:2810#myDomainOriginalJNDI

From my code when used new InitialContext().lookup("java:comp/env/myDomainObj")

I got an exception
[3/23/06 22:23:58:395 EST] 47115a81 Helpers W NMSV0605W: A Reference object looked up from the context "java:" with the name "comp/env/myDomainObj" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ws.util.ResRefJndiLookupObjectFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: java.lang.Object
Type: ResRefJndiLookupInfo
Content: com.ibm.ws.util.ResRefJndiLookupInfo@f6dda9f ResRefJndiLookupInfo: Look up Name="myDomainObj";JndiLookupInfo: jndiName="corbaname:iiop://babji:2810#myDomainOriginalJNDI"; providerURL=""; initialContextFactory=""

Exception data follows:
org.omg.CORBA.BAD_PARAM: empty iiop_addr minor code: 4F4D0009 completed: No
at com.ibm.rmi.corba.IIOPAddrImpl.<init>(IIOPAddrImpl.java:64)
at com.ibm.rmi.corba.Corbaloc.parseObjAddr(Corbaloc.java:230)
at com.ibm.rmi.corba.Corbaloc.parseObjAddrList(Corbaloc.java:176)
at com.ibm.rmi.corba.Corbaloc.parseCorbaloc(Corbaloc.java:141)
at com.ibm.rmi.corba.Corbaname.<init>(Corbaname.java:104)
at com.ibm.rmi.corba.ORB.createObjectURL(ORB.java:2643)
at com.ibm.rmi.corba.ORB.createObjectURL(ORB.java:2600)
at com.ibm.CORBA.iiop.ORB.createObjectURL(ORB.java:2839)
at com.ibm.ws.naming.corbaname.corbanameURLContext.getObjUrlAndStringifiedName(corbanameURLContext.java:87)
at com.ibm.ws.naming.util.CorbaURLContext.setupForLookup(CorbaURLContext.java:99)
at com.ibm.ws.naming.util.CorbaURLContext.lookup(CorbaURLContext.java:438)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
 
Babji Reddy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Andreas,
Where art though
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!