Hi,
add:
<jvm-options>-Dcom.sun.enterprise.server.ss.ASQuickStartup=false</jvm-options>
in domain.xml and your code will works fine.
Can you file an issue here:
https://glassfish.dev.java.net/servlets/ProjectIssues
category: others assignee: binod
Thanks
-- Jeanfrancois
glassfish_at_javadesktop.org wrote:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>