users@glassfish.java.net

Discovery of the port number

From: <glassfish_at_javadesktop.org>
Date: Wed, 29 Aug 2007 08:06:20 PDT

Is there anyway to determine what port a glassfish instance is running on?

What I'm trying to do, is on startup have a servlet register itself with a servlet in another web app on the same server.

So when FooServlet starts up and wants to register itself with the DirectoryServlet, there's no way for me to build the full URL to the directory. I know the host (localhost) and the url to the servlet (/Directory/Register) but I don't know the port number. So that means that if glassfish isn't running on port 80, the registration will fail.

Worst case scenario, I could make the port configurable in the applications, but I'd prefer if there were some way of finding this information from glassfish.
[Message sent by forum member 'jodeen' (jodeen)]

http://forums.java.net/jive/thread.jspa?messageID=233084