GlassFish v3 Domain Server cannot start. Port is occupied
Asked Answered
B

13

9

I imagine this is a pretty generic error. I cant seem to find any documentation on it.

I am simply attempting to run a java web project with jsp's and beans... using netbeans 6.8 on windows xp.

Thoughts? apologies for such a newb question.

-Kirb

Bibliomania answered 2/3, 2010 at 19:23 Comment(3)
Take a look in the glassfish logs to see if there is any more specific information (port number, etc).Boulanger
SEVERE: Exception in command execution : java.lang.IllegalArgumentException: URI has an authority componentBibliomania
This is answer worked for me: https://mcmap.net/q/1120014/-glassfish-v3-domain-server-cannot-start-port-is-occupiedParlormaid
I
14

you need to know who occupied the port. run in cmd netstat -aon | find ":80" | find "LISTENING" you will see process id. go to Task Manager and drop it.

Icy answered 2/3, 2010 at 19:33 Comment(6)
>netstat -aon | find ":80" | find "LISTENING" TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4028Bibliomania
that's it. open Task Manager, then click View, Select columns... then tick PID. Then find process with PID = 4028, right click on it and then end processIcy
i killed the process and reran the project... and everythign repeated.. new pid and all. Same error msg. configuration issue?Bibliomania
That solved the title of this question.. my issue is different i spose. ill enter a new question for that one.Bibliomania
looks like Glassfish can't start/stop grasefully. Sorry, i am not very good in Glassfish itselfIcy
The problem is that actually glassfish requires that /etc/hostname and /ets/hosts matchBankrupt
C
12

In Linux you get this error if the servername is not in the hosts file

check /etc/hostname and make sure there is an entry in /etc/hosts with

127.0.0.1 [your_hostname]

Cyna answered 4/4, 2011 at 3:10 Comment(2)
This is actually the real fix for this problem.Bankrupt
This is actually the real solution to the problem.Cut
K
3

If you get errors from glassfish on startup complaining that ports are already in use, and you know they aren't, the problem is almost certainly that your hostname is set incorrectly. Glassfish seems to look up the hostname for the machine and then to bind to a port using that hostname - if your hostname resolves incorrectly then it won't be able to bind and will report that the port is in use.

at the command line try typing 'hostname' to see whether the hostname that's reported is correct. ping it and check that it resolves to the IP address of your machine.

Have a look at your /etc/hosts file (on linux) and check whether everything is ok in there.

Also check the /etc/sysconfig/network file and make sure your hostname is set correctly in there.

I've had the exact same problem as you twice - and both times it's turned out to be a hostname issue. Glassfish really should have better error reporting about this.

Klinges answered 13/6, 2011 at 12:37 Comment(1)
This answer got me pointed in the right direction. Somehow (Rackspace Cloud) my /etc/hosts ended up with the wrong permissions, which caused this error. A simple "chmod 644 /etc/hosts" fixed the error.Chryso
A
2

I was just encountering this issue. What I did was open my browser, pointed to localhost:8080. It looked like I already had an instance of Glassfish running.

So I then went to localhost:4949 (Glassfish server administration page) clicked on 'server (Admin Server)' in the left pane, then pressed the 'Stop' button.

I tried to deploy the J2EE application once again, this time successfully.

Attu answered 14/4, 2011 at 1:39 Comment(0)
P
1

I have faced to this problem(Win Xp and netbeans 7.0) and solved it. It's a NOD32 3.0 antiviris issue which i'm using. To solve it open nod32 antivirus

settings > choose protection against viruses and spyware > choose internet access protection > choose HTTP > choose Web Browsers

Then mark your netbeans IDE in the list of programs with red cross(by double clicking)

P.S. the real path to above settings in nod32 may vary in your environment as I'm using not an English version of antivirus, I've just translated the above path.

Phaih answered 21/8, 2011 at 16:1 Comment(0)
H
1

The answer is to kill the process java.exe just like Andy said with this : netstat -aon | find ":80" | find "LISTENING". The server confuses the localhost IP with the localhost port 8080 so you should make sure to delete any other server with the same domain name registered.

Hocuspocus answered 23/4, 2012 at 10:42 Comment(0)
A
1

If you are running already a tomcat or apache server you should stop them and running again your application , it works for me, service [servicename] stop !

Apomict answered 6/11, 2014 at 1:52 Comment(0)
C
1

type localhost:8080 at browser and discover what is using the 8080

Caban answered 29/4, 2015 at 6:34 Comment(0)
S
0

I use NetBeans*+Glassfish 4 under Ubuntu 14.04 . I get the same error . The issue has been resolved when i stop running TOMCAT .

sudo service tomcat7 stop
Specht answered 9/8, 2014 at 13:23 Comment(0)
L
0

I face this problem. and i am very suffered to solve. the solution is only one command line ..... sudo service tomcat7 stop

Lecher answered 22/8, 2014 at 13:12 Comment(1)
Hi, and welcome to StackOverflow! Your solution can indeed help people who have the same problem, but it is not very generic, perhaps other people have some other program running on port 80. The accepted answer takes that into account.Antinode
G
0

As Andrey said, first, in the command line type:

> netstat -aon | find ":80" | find "LISTENING"

Next, kill the task of the result

> taskkill /F /pid 4996

Where 4996 is the pid you get when you type the netstat command. I had the same problem, but the task did not appear in the task manager so I had to use the taskkill command.

Guide answered 20/3, 2017 at 19:3 Comment(0)
P
-1

You have to start GlassFish manually. Go to the console and run this command:

c:\glassfishv3\bin>asadmin start-domain

and run your project in netbeans.

Perversion answered 23/4, 2010 at 21:53 Comment(0)
L
-1

In netbeans, go to Tools/Servers and add the glassfish server. Specifically, find the folder of your glassfish installation.

Lower answered 22/5, 2011 at 17:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.