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="java.net.*" %><%=InetAddress.getLocalHost()%>

     

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

     

     

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

     

                <permission type="java.net.SocketPermission" name="*" actions="connect,resolve,listen,accept" />            <permission type="java.security.SecurityPermission" name="*" actions="*"/>            <permission type="socket" name="*" actions="connect,resolve,listen,accept"/>           


    最新回复(0)