users@glassfish.java.net

Re: Is it allowed to open a ServerSocket port from a bootstrap class?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 12 Mar 2008 21:12:56 -0400

Hi,

glassfish_at_javadesktop.org wrote:
> Hi,
>
> I followed your instruction to add
>
> <jvm-options>-Dcom.sun.enterprise.server.ss.ASQuickStartup=false</jvm-options>

Have you stopped/started the server?

>
> to the domain.xml file. But there is no difference: when I access the port from a client, the connection is refused.
>
> I have found another interesting thing: actually, the port is closed when the server is ready. I printed debug information saying the port is open, the ServerSocket is not null. But when Glassfish is running (supposed to keep the port open), I can run another program which opens the same port. So the port is closed. Which program closes the port?

GlassFish isn't closing any ports and doesn't have any mechanism for
doing that....Tomcat run on the same machine and your application open
the same port and it works? This is strange....

Can you wrap your ServerSocket.accpet() method with a try/catch and see
what is the exception you are getting? The exception might be swallowed
so might be a good idea to start with a debugger and add a breakpoint on
the accept() to see how come it exit the loop (that's the only way the
port can be closed).

A+

-- Jeanfrancois


>
> Any information would be appreciated. Thanks in advance.
> [Message sent by forum member 'weijiang' (weijiang)]
>
> http://forums.java.net/jive/thread.jspa?messageID=263698
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>