I have the following code that runs fine under standard Java main app, but not under web app running under Sun Java App server. The above exception was generated. Do I need to change policy or anything like that to get this to work? Thanks. This is "Sun Java System Application Server Platform Edition 9.0_01 (build )"
try {
ServerSocketChannel resultChannel = ServerSocketChannel.open();
InetSocketAddress listenOn = null;
resultChannel.socket().bind(listenOn);
int resultPort = Integer.valueOf(resultChannel.socket().getLocalPort());
System.out.println("The result port is: " + resultPort);
} catch (Exception e) {
e.printStackTrace();
}
[Message sent by forum member 'st946tbf_3' (st946tbf_3)]
http://forums.java.net/jive/thread.jspa?messageID=232126