aspose file tools*
The moose likes Websphere and the fly likes JNDI Lookup Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI Lookup Error" Watch "JNDI Lookup Error" New topic
Author

JNDI Lookup Error

Jaideep Joshi
Greenhorn

Joined: Mar 12, 2004
Posts: 18
Hi all,
I have samll program which tries to lookup a queue connection factory in WAS 5.1 JNDI.
I get the inital context by this way:
private static Context getInitialContext() {
Context ctx =null;
try {
Properties properties = new Properties();
properties.put(Context.PROVIDER_URL, "iiop://localhost:9090");
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
ctx = new InitialContext(properties);
} catch (Exception ex) {
ex.printStackTrace();
}
return ctx;
}
When I execute follwing lines :
ctx = getInitialContext();
QueueConnectionFactory qcf = null;
qcf = (QueueConnectionFactory)ctx.lookup( qcfName );
I get following exception:
java.lang.UnsatisfiedLinkError: registerNatives
at com.ibm.jvm.ExtendedSystem.registerNatives(Native Method)
at com.ibm.jvm.ExtendedSystem.<clinit>(ExtendedSystem.java:176)
at com.ibm.rmi.util.JDKBridge.setCodebaseProperties(JDKBridge.java:226)
at com.ibm.rmi.util.JDKBridge.<clinit>(JDKBridge.java:205)
at com.ibm.rmi.util.RepositoryId.<clinit>(RepositoryId.java:122)
at com.ibm.rmi.iiop.CDROutputStream.<clinit>(CDROutputStream.java:1077)
at com.ibm.rmi.corba.ORB.<init>(ORB.java:250)
at com.ibm.rmi.iiop.ORB.<init>(ORB.java:166)
at com.ibm.CORBA.iiop.ORB.<init>(ORB.java:521)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at org.omg.CORBA.ORB.create_impl(ORB.java:295)
at org.omg.CORBA.ORB.init(ORB.java:336)
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:77)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:98)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:74)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:284)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:365)
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.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at TestSendMessage.main(TestSendMessage.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Please help...
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
You must wrap your program in an Application Client JAR file and place it within an EAR and then invoke it using the J2EE client container. Read in the InfoCenter under "LaunchClient" or read the EJB client chapter of my book.
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.
Jaideep Joshi
Greenhorn

Joined: Mar 12, 2004
Posts: 18
Kyle,
I tried ypur solution. Now I get different error message.
Here is what I get, any clue ???:
C:\WS\WebSphere\AppServer\bin>launchClient D:\tmp\TestClient.ear
IBM WebSphere Application Server, Release 5.1
J2EE Application Client Tool
Copyright IBM Corp., 1997-2003
WSCL0012I: Processing command line arguments.
WSCL0013I: Initializing the J2EE Application Client Environment.
WSCL0035I: Initialization of the J2EE Application Client Environment has complet
ed.
WSCL0014I: Invoking the Application Client class TestSendMessage
Sending message: 'This is test queue sender program.'
Retrieving a QueueConnectionFactory from JNDI
javax.naming.CommunicationException: A communication failure occurred while atte
mpting to obtain an initial context with the provider URL: "iiop://jjoshi.braunc
onsult.com:9090". Make sure that any bootstrap address information in the URL i
s correct and that the target name server is running. A bootstrap address with
no port specification defaults to port 2809. Possible causes other than an inco
rrect bootstrap address or unavailable name server include the network environme
nt and workstation network configuration. Root exception is org.omg.CORBA.COMM_
FAILURE: purge_calls:1218 reason=1 state=5 vmcid: IBM minor code: 306 complete
d: Maybe
at com.ibm.rmi.iiop.Connection.purge_calls(Connection.java:1217)
at com.ibm.rmi.iiop.Connection.doReaderWorkOnce(Connection.java:2617)
at com.ibm.rmi.transport.ReaderThread.run(ReaderPoolImpl.java:136)
Unexpected error A communication failure occurred while attempting to obtain an
initial context with the provider URL: "iiop://jjoshi.braunconsult.com:9090". M
ake sure that any bootstrap address information in the URL is correct and that t
he target name server is running. A bootstrap address with no port specificatio
n defaults to port 2809. Possible causes other than an incorrect bootstrap addr
ess or unavailable name server include the network environment and workstation n
etwork configuration.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
The error message has what you need. The bootstrap port for IIOP in WAS V5 is NOT 9090, it's 2809. Change it in your program. You also might want to look at this article.
Kyle
Jaideep Joshi
Greenhorn

Joined: Mar 12, 2004
Posts: 18
Kyle, your solution worked...Thanks.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
You are welcome.
Kyle
Visesh SV
Greenhorn

Joined: Apr 10, 2004
Posts: 2
Hey Kyle,
I am facing the same exception
java.lang.reflect.InvocationTargetException: java.lang.UnsatisfiedLinkError: regsterNatives
at com.ibm.jvm.ExtendedSystem.registerNatives(Native Method)
at com.ibm.jvm.ExtendedSystem.<clinit>(ExtendedSystem.java:163)
at com.ibm.rmi.util.JDKBridge.setCodebaseProperties(JDKBridge.java:224)
at com.ibm.rmi.util.JDKBridge.<clinit>(JDKBridge.java:203)
at com.ibm.rmi.util.RepositoryId.<clinit>(RepositoryId.java:100)
at com.ibm.rmi.iiop.CDROutputStream.<clinit>(CDROutputStream.java:917)
at com.ibm.rmi.corba.ORB.orbParameters(ORB.java:1146)
at com.ibm.CORBA.iiop.ORB.orbParameters(ORB.java:1102)
at com.ibm.rmi.corba.ORB.set_parameters(ORB.java:1101)
at com.ibm.CORBA.iiop.ORB.set_parameters(ORB.java:1639)
at org.omg.CORBA.ORB.init(Unknown Source)
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:77)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:189)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:98)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:74)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:367)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:313)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(W
nInitCtxFactory.java:363)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:4
8)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(Unknown Source)
But I have written a thin client. I need to know what all things I need to setup on the machine to make the thin client work.
Thanks
Visesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI Lookup Error