Topic
2 replies Latest Post - ‏2013-11-14T09:48:40Z by sauro02
sauro02
sauro02
2 Posts
ACCEPTED ANSWER

Pinned topic Need to find the server name form an WLP app

‏2013-11-13T11:26:15Z |

I need to be able to find the name of the server name that an application is running in from Liberty Profile 8.5.5 . This has to be from the running app and not from a configuration file.

 

Thanks in advance for your help.

  • Alasdair
    Alasdair
    55 Posts
    ACCEPTED ANSWER

    Re: Need to find the server name form an WLP app

    ‏2013-11-13T20:00:16Z  in response to sauro02

    This page in the infocenter explains how to do this:

    http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.wlp.core.doc/ae/rwlp_dirs.html

    basically you want to add this to your server.xml:

    <featureManager>
       <feature>jndi-1.0</feature>
    </featureManager>
    <jndiEntry jndiName="serverName" value="${wlp.server.name}" />

    Then from your application write the following code:

    new InitialContext().lookup("serverName");

    • sauro02
      sauro02
      2 Posts
      ACCEPTED ANSWER

      Re: Need to find the server name form an WLP app

      ‏2013-11-14T09:48:40Z  in response to Alasdair

      Hi Alasdair,

       

      thank you for your reply, unfortunately it will not work for me. As I said in my original post the information cannot be read from a configuration file. The code I work with auto instruments (injects code into)  the running code of all deployed applications for monitoring purposes at runtime. It is not permitted to edit any of the application source files. We already do this for standard websphere, but the method used is not replicated in Liberty Profile.