Sunday, May 4, 2014

Retrieving WebLogic Server Name and Port in ADF Application

It could come handy to know how to get WebLogic server name and port in ADF application. Particularly this could be useful, when running ADF application in the cluster and there is a requirement to track WebLogic node with application session instance running. Usually it is not enough to get server host, as cluster node is accessed through load balancer and server IP is different, not the one visible in HTTP session.

There is a way to get WebLogic server name and port. Server name could be retrieved from system property - weblogic.Name. Port could be retrieved from MBean - see the code below:


Server name and port is retrieved and displayed correctly for my test environment - DefaultServer and 7101:


You can download sample application - WLSEnvironmentAccessApp.zip to check how it works.

6 comments:

Onkar Shoker said...

Great post, thanks.

Was useful for testing load balancer. :)

Andrejus Baranovskis said...

This was the idea :)

Andrejus

Rajesh said...

Andrejus,
Is there a way to get server name using EL?
Thanks,
Rajesh

Andrejus Baranovskis said...

This is already implemented in the sample app.

Andrejus

Rajesh said...

Andrejus,
I mean without any java code, just using EL. So i can be added to the app through customization.
Thanks,
Rajesh

Andrejus Baranovskis said...

If there would be simple EL, I would post it instead :)

You need to upload Java class to customisation library and reference method using EL through MDS, this would work.

Andrejus