Newbie question: Helloworld on Getting started throws java.net.BindException: Address in use

1,713 views
Skip to first unread message

Muralidhar Chapa

unread,
Sep 22, 2014, 1:37:46 PM9/22/14
to dropwiz...@googlegroups.com
Sorry folks, for this newbie question. 

Can't wrap my head around this one. I followed the hello world example as posted on "https://dropwizard.github.io/dropwizard/getting-started.html". When, I am trying to run the jar, i get the following exception: 

ERROR [2014-09-22 17:32:25,897] io.dropwizard.cli.ServerCommand: Unable to start server, shutting down

! java.net.BindException: Address already in use

! at sun.nio.ch.Net.bind0(Native Method) ~[na:1.7.0_40]

! at sun.nio.ch.Net.bind(Net.java:444) ~[na:1.7.0_40]

! at sun.nio.ch.Net.bind(Net.java:436) ~[na:1.7.0_40]

! at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) ~[na:1.7.0_40]

! at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.7.0_40]

! at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:264) ~[dropwizard-0.1.0.jar:0.1.0]

! at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:200) ~[dropwizard-0.1.0.jar:0.1.0]

! ... 8 common frames omitted

! Causing: java.lang.RuntimeException: java.net.BindException: Address already in use

! at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:213) ~[dropwizard-0.1.0.jar:0.1.0]

! at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarting(AbstractLifeCycle.java:187) ~[dropwizard-0.1.0.jar:0.1.0]

! at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) ~[dropwizard-0.1.0.jar:0.1.0]

! at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:43) ~[dropwizard-0.1.0.jar:0.1.0]

! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43) [dropwizard-0.1.0.jar:0.1.0]

! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76) [dropwizard-0.1.0.jar:0.1.0]

! at io.dropwizard.cli.Cli.run(Cli.java:70) [dropwizard-0.1.0.jar:0.1.0]

! at io.dropwizard.Application.run(Application.java:72) [dropwizard-0.1.0.jar:0.1.0]


I'm using 0.7.1 of DW. Any inputs on this, would be really great !!

~Murali

Robert Sokolowski

unread,
Sep 22, 2014, 1:41:32 PM9/22/14
to dropwiz...@googlegroups.com
Hi Murali, 

Sounds like have an instance of DW still running from a pervious time you ran it.

grep for the java process:

ps -ef | grep java

Get the PID, then:

kill -9 PID

Let us know if that works.

Cheers, 
Rob

--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shan Syed

unread,
Sep 22, 2014, 1:55:47 PM9/22/14
to dropwiz...@googlegroups.com
could also just be *anything* else consuming 8080; perhaps a Tomcat webapp, Apache, etc..
even some builds of Skype took over 80 or 8080


Muralidhar Chapa

unread,
Sep 22, 2014, 3:06:46 PM9/22/14
to dropwiz...@googlegroups.com
Nopes. Looked at all processes running at port 8080 and found nothing. Even connected via browser to ensure that there is nothing running on 8080. 

ps -ef | grep java just gives me my IDE and my own process for querying. 

Alternatively, is there any command line parameter to have the default port changed to something else like 18080 which i know nobody is using? 

~Murali

Michael McCarthy

unread,
Sep 22, 2014, 4:23:23 PM9/22/14
to dropwiz...@googlegroups.com
Could you have a look and see if anything is listening on 8081?

Muralidhar Chapa

unread,
Sep 22, 2014, 5:35:05 PM9/22/14
to dropwiz...@googlegroups.com
Bingo !!! I see Mcafee related logs on 8081 console. It could be that there's something related to Mcafee running. 

Let me re-phrase the question then: is it possible for dw to be started at any other port, while i try to figure out from Mcafee settings. 

~Murali

Michael McCarthy

unread,
Sep 22, 2014, 6:16:59 PM9/22/14
to dropwiz...@googlegroups.com

Hi, yes it is, if you look at the core documentation section on the site you will see something like this:
Note

You can override configuration settings by passing special Java system properties when starting your application. Overrides must start with prefix dw., followed by the path to the configuration value being overridden.

For example, to override the Logging level, you could start your application like this:

java -Ddw.logging.level=DEBUGserver my-config.json

This will work even if the configuration setting in question does not exist in your config file, in which case it will get added.

You can override configuration settings in arrays of objects like this:

java -Ddw.server.applicationConnectors[0].port=9090server my-config.json

I'm not in front of a machine now but as it's the admin port that is clashing you will want to choose array position 1 (I think, off the top of my head). Otherwise just add the port you want to your yaml file in the appropriate section.

Michael

--
You received this message because you are subscribed to a topic in the Google Groups "dropwizard-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dropwizard-user/wA2AH8O4FfQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dropwizard-us...@googlegroups.com.

Muralidhar Chapa

unread,
Sep 22, 2014, 8:01:33 PM9/22/14
to dropwiz...@googlegroups.com
Thanks a bunch @Michael and all others who chipped in. I took the route of specifying the default overrides in the yaml file and it worked for me: 


Thanks again all for the comments/tips. As correctly predicted by Michael, it was the port clash at 8001 which was preventing the app from coming up. I think, we should just update the error message/exception to reflect that. 

~Murali 
Reply all
Reply to author
Forward
0 new messages