Monday, July 25, 2016

Weblogic 12.2.1:Java - JMX to get the Server Name and port

 The following section of code discusses how to get the Server Name and Port for the managed server or a cluster where the API is deployed.

     public static Integer getPort() {
       Integer port=null; 
       try {
            InitialContext ctx = new InitialContext();
            String serverName = System.getProperty("weblogic.Name");

            MBeanServer server =
                (MBeanServer)ctx.lookup("java:comp/env/jmx/runtime");

            ObjectName objName =
                new ObjectName("com.bea:Name=" + serverName + ",Type=Server");
            port = (Integer)server.getAttribute(objName, "ListenPort");
            
            ctx.close();
             
            
        } catch (Exception e) {
            e.printStackTrace();
        }
        return port;
    }

Amazon Bedrock and AWS Rekognition comparison for Image Recognition

 Both Amazon Bedrock and AWS Rekognition are services provided by AWS, but they cater to different use cases, especially when it comes to ...