easiest way to find port number


what is easiest way to find port number on various webservers like tomcat, application servers like weblogic, websphere,boss etc where the applications are running. please advise
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnBusiness Consultant (Owner)Commented:
Consider running TCP View (Sys Internals from Microsoft) . It will do what you want quite nicely.
Dave BaldwinFixer of ProblemsCommented:
If you are on Windows (and on the server), TCPView https://technet.microsoft.com/en-us/library/bb897437.aspx will tell you what ports are in use by what applications.  It is based on the 'netstat' command line program which is also available on Linux.  https://en.wikipedia.org/wiki/Netstat
Actually there's no need to install anything. netstat alone will tell you what you need to know
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

If you want to find it within your program, then you could use
int port = request.getLocalPort();

Open in new window

in a Servlet or in a scriptlet. In a JSP expression, use

Open in new window

or in JSP text use

Open in new window

gudii9Author Commented:
netstat alone will tell you what you need to know
what is netstat and how to know using that.

I do not want to write a program to know. Different servers has different places to go to find it. For example in websphere i have to drill down to
C:/ProgramFiles/IBM/..../profile.txt i think has the port number which says like 9080.  some servers after starting i have to go to admin console some place to see for tomcat i think. So is there is a link or place which tells where to go to find for specific server to find the port number. Remember port numbers could change also over period of time so i may want to to check it time to time as well.

when i opened cmd on my windows laptop and typed netstat i saw like (no port numbers here?)
  TCP    upload-lb:https        ESTABLISHED
Dave BaldwinFixer of ProblemsCommented:
'https' means port 443.  'netstat' and TCPview will use names for 'well known' ports unless you tell them not to.
what is netstat and how to know using that.

Documentation on netstat is not hard to find:

gudii9Author Commented:

i forgot the path today.

Other day i was able to open profile.txt.

can you please advise complete path?

when i search under IBM with profile.txt nothing shows up.

i searched under IBM folder with profiles.txt that also did not work.

please advise
gudii9Author Commented:
C:\Program Files \IBM\WebSphere\AppServer8\profiles\DevelopmentServerProfile
under that i do not see profile.txt though. I remember seeing that earlier. i forgot the path now. please advise
Why not just do a global search for the file?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gudii9Author Commented:
not able t find with that.
gudii9Author Commented:
I finally found it. I was looking with wrong file name
C:\Program Files\IBM\WebSphere\AppServer8\profiles\TestServerProfile\logs\AboutThisProfile.txt

In above file i see all good stuff like below

Application server environment to create:
Disk space required:
Profile name:
Make this profile the default:
Node name:
Host name:
Enable administrative security (recommended):
Administrative console port:
Administrative console secure port:
HTTP transport port:
HTTPS transport port:
Bootstrap port:
SOAP connector port:
Run application server as a service:
Create a Web server definition:
Performance tuning setting:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.