Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address already in use #119

Closed
damianoneill opened this issue Mar 26, 2019 · 2 comments
Closed

Address already in use #119

damianoneill opened this issue Mar 26, 2019 · 2 comments

Comments

@damianoneill
Copy link

damianoneill commented Mar 26, 2019

Hi, working through https://quarkus.io/guides/building-native-image-guide running the following command;

 ./mvnw package -Pnative

Results in

Caused by: java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:178)
	at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:310)
	at io.undertow.Undertow.start(Undertow.java:193)
	... 43 more
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.966 s <<< FAILURE! - in org.acme.config.GreetingResourceTest
[ERROR] org.acme.config.GreetingResourceTest  Time elapsed: 0.965 s  <<< ERROR!
java.lang.RuntimeException: Failed to start quarkus
Caused by: java.lang.RuntimeException: java.net.BindException: Address already in use
Caused by: java.net.BindException: Address already in use

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   GreetingResourceTest » Runtime Failed to start quarkus
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for quickstart-projects 1.0-SNAPSHOT:
[INFO]
[INFO] application-configuration .......................... FAILURE [  3.096 s]
[INFO] application-lifecycle-events ....................... SKIPPED

My listening port list is

$ netstat -ap tcp | grep -i "listen"
tcp46      0      0  *.sunproxyadmin        *.*                    LISTEN
tcp46      0      0  *.64822                *.*                    LISTEN
tcp4       0      0  localhost.boks_clntd   *.*                    LISTEN
tcp4       0      0  *.17500                *.*                    LISTEN
tcp6       0      0  *.17500                *.*                    LISTEN
tcp4       0      0  localhost.17603        *.*                    LISTEN
tcp4       0      0  localhost.17600        *.*                    LISTEN
tcp6       0      0  localhost.6263         *.*                    LISTEN
tcp4       0      0  localhost.6263         *.*                    LISTEN
tcp6       0      0  localhost.6258         *.*                    LISTEN
tcp4       0      0  localhost.6258         *.*                    LISTEN
tcp4       0      0  localhost.9005         *.*                    LISTEN
tcp4       0      0  localhost.4244         *.*                    LISTEN
tcp6       0      0  *.996                  *.*                    LISTEN
tcp4       0      0  *.999                  *.*                    LISTEN
tcp6       0      0  *.1012                 *.*                    LISTEN
tcp4       0      0  *.1017                 *.*                    LISTEN
tcp6       0      0  *.1019                 *.*                    LISTEN
tcp4       0      0  *.1021                 *.*                    LISTEN
tcp6       0      0  *.sunrpc               *.*                    LISTEN
tcp4       0      0  *.sunrpc               *.*                    LISTEN
tcp6       0      0  *.nfsd                 *.*                    LISTEN
tcp4       0      0  *.nfsd                 *.*                    LISTEN
tcp6       0      0  *.1022                 *.*                    LISTEN
tcp4       0      0  *.1023                 *.*                    LISTEN
tcp46      0      0  *.upnotifyp            *.*                    LISTEN
tcp4       0      0  *.upnotifyp            *.*                    LISTEN
tcp4       0      0  *.kerberos             *.*                    LISTEN
tcp6       0      0  *.kerberos             *.*                    LISTEN
tcp4       0      0  *.ssh                  *.*                    LISTEN
tcp6       0      0  *.ssh                  *.*                    LISTEN
tcp4       0      0  *.rfb                  *.*                    LISTEN
tcp6       0      0  *.rfb                  *.*                    LISTEN

Can you tell me what port is causing the problem and how I modify the configuration to change the conflicting port?

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G1815

$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

$ git rev-parse HEAD
fa85915

Thanks.

@kameshsampath
Copy link
Contributor

@damianoneill
there might be an application running on port 8081 which by default used by Quarkus test. You can overcome this issue by adding a application property quarkus.http.test-port, you can also do the same via maven surefire plugin as shown below:

<plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${surefire.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <systemProperties>
                <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                <quarkus.http.test-port>8080</quarkus.http.test-port>
              </systemProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
<plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire.version}</version>
        <configuration>
          <systemPropertyVariables>
            <quarkus.http.test-port>8080</quarkus.http.test-port>
          </systemPropertyVariables>
          <systemProperties>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>            
          </systemProperties>
        </configuration>
      </plugin>

@damianoneill
Copy link
Author

Thankyou @kameshsampath that resolved the issue, macmnsvc (McAfee AV) was listening on that port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants