My Web service will run on a Jboss App Server or a Websphere app Server. For both of them I need to know the instance name, for Jboss I can use System.getProperty("jboss.server.name"),
but what can I use for WebSphere? I can't use WebSphere-specific methods, I need to call System.properties
Thanks
WebSphere® Application Server is a comprehensive, sophisticated, Java™ 2 Enterprise Edition (J2EE) and Web services technology-based application system.
For the application server, select Servers > Server Types > WebSphere application servers > application_server > Ports. Select a port whose host name needs changing. Change the host name in the Host field; Click OK.
An alternative, at least for WebSphere, is to look it up in the JNDI tree. This is what I use:
InitialContext ic = new javax.naming.InitialContext();
String serverName = ic.lookup("servername").toString();
This way I don't have to configure anything as WebSphere binds that information for me.
Cell and node name can also be retrieved using "thisNode/cell/cellname" and "thisNode/nodename". Something useful in clusters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With