I have written a session bean in my IBM websphere server.
I want to invoke this bean in my spring application. So I have written spring application in eclipse and written unit test for testing this scenario. But it throws error message as follows.
javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context using the provider url: "iiop://192.168.0.19:2809/cell/nodes/localhost/servers/server1". Make sure that the host and port information is correct and that the server identified by the provider url is a running name server. If no port number is specified, the default port number 2809 is used. Other possible causes include the network environment or workstation network configuration. [Root exception is org.omg.CORBA.TRANSIENT: Connection refused:host=192.168.0.19,port=2809 vmcid: 0x4942f000 minor code: 769 completed: No]
However I tried to run the same program(without any change) in websphere server. It is working fine. I don't understand what is wrong on it.
Any help appreciated.
You most certainly have written your test assuming you have a live environment (started server, etc). However, you probably execute your test outside of the server context (with no server running). The code cannot make the neccessary lookups, etc.
You must rewrite your tests to not depend on any live dependencies, or run your tests from within a running server.
My point is when I run my junit test case from eclipse it was failed to lookup websphere server even though the websphere is up and running. How do I rewrite my code to make it work.