Blackboard problem: InetAddress.getLocalHost always returns "localhost"

    技术2022-05-12  4

    In building block, I just add following codes in a simple jsp file for check current server IP and testing load balance issue:


    <%@ page import="*" %><%=InetAddress.getLocalHost()%>


    it always returns "localhost/" which should be like casey03/



    The solution is that you must add following codes to bb-manifest.xml:


                <permission type="" name="*" actions="connect,resolve,listen,accept" />            <permission type="" name="*" actions="*"/>            <permission type="socket" name="*" actions="connect,resolve,listen,accept"/>