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

vkraemer
  • 9,864
  • 2
  • 30
  • 44
Kirby
  • 1,980
  • 3
  • 21
  • 33

13 Answers13

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.

Andrey
  • 59,039
  • 12
  • 119
  • 163
  • >netstat -aon | find ":80" | find "LISTENING" TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4028 – Kirby Mar 02 '10 at 19:36
  • 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 process – Andrey Mar 02 '10 at 19:37
  • i killed the process and reran the project... and everythign repeated.. new pid and all. Same error msg. configuration issue? – Kirby Mar 02 '10 at 19:41
  • That solved the title of this question.. my issue is different i spose. ill enter a new question for that one. – Kirby Mar 02 '10 at 19:49
  • looks like Glassfish can't start/stop grasefully. Sorry, i am not very good in Glassfish itself – Andrey Mar 02 '10 at 20:17
  • The problem is that actually glassfish requires that /etc/hostname and /ets/hosts match – Robert Grezan Apr 16 '12 at 20:31
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]

javadude
  • 1,763
  • 1
  • 19
  • 38
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.

jportway
  • 917
  • 8
  • 17
  • 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. – Michael van der Westhuizen Jan 29 '13 at 13:04
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.

Yeison
  • 193
  • 3
  • 6
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.

Beau Grantham
  • 3,435
  • 5
  • 33
  • 43
nagamora
  • 11
  • 1
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 !

1

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

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.

maks
  • 5,911
  • 17
  • 79
  • 123
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
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
0

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

ebsom
  • 31
  • 1
  • 6
  • 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. – ljgw Aug 22 '14 at 13:17
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.

Mr. DMX
  • 653
  • 2
  • 9
  • 20
-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.

Kevin Worthington
  • 457
  • 2
  • 5
  • 17
carlos
  • 1
-1

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

andy
  • 1