1

I have migrated everything and deployed the application to the new server. When I try running it, I get the following exception:

A communication failure occurred while attempting to obtain an initial context with the provider URL: "corbaloc:iiop:127.0.0.1:2809". Make sure that any bootstrap address information in the URL is 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 incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration.

Now, on full profile I know where to see the bootstrap address and how to configure it. I couldn't find anything on the Liberty profile though. I did have a look at several IBM documentations but can't find how to do it. Anyone here might point me in the right direction?

Just to include everything, here is the relevant part in the jndi.properties file:

java.naming.provider.url=corbaloc:iiop:127.0.0.1:2809 java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory

I have as of yet never worked with either WAS other than deploying applications nor have I worked with JNDI lookups or anything. I know that there is a factory that uses the java.properties file though.

Since I want to migrate with as little effort as possible I assume that the easiest would be to change the bootstrap address in the Liberty rather than changing the running code in the application.

Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
EviL GaMer
  • 133
  • 13
  • 1
    Would the iiop port options work here: https://www.ibm.com/support/knowledgecenter/en/SSAW57_liberty/com.ibm.websphere.liberty.autogen.nd.doc/ae/rwlp_config_orb.html#iiopEndpoint ? or here? https://www.ibm.com/support/knowledgecenter/en/SS7K4U_8.5.5/com.ibm.websphere.wlp.zseries.doc/ae/rwlp_portnums.html – ewhoch Apr 18 '18 at 13:02
  • Thank you very much, that helped. I was too fixated on looking for it in the context of IBM ODM. – EviL GaMer Apr 18 '18 at 19:12

2 Answers2

1

For using a JNDI in an application on WebSphere Liberty, it should not be necessary to configure any special properties (such as the java.naming.* ones you mention).

To use JNDI on Liberty, enable the JNDI feature in your server.xml:

<featureManager>
  <feature>jndi-1.0</feature>
</featureManager>

And then you can obtain an InitialContext and perform lookups in your application's Java code like this:

DataSource myDs = InitialContext.doLookup("jdbc/myDataSource");
Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
1

If you need to set the bootstrap address to a non-default value, you can do that in the server.xml with the <iiopEndpoint> element, like:

<iiopEndpoint id="defaultIiopEndpoint" iiopPort="2809"/>

with the full documentation for the ORB here.

ewhoch
  • 341
  • 2
  • 7