Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transport dt_socket 8787 already in use

I am trying to run a Server and Client application in Jetty server on my Ubuntu 12.04 machine. The server starts without any problem and I used the following command

$ mvn jetty:run

on issuing this command the first line was

Listening for transport dt_socket at address: 8787

But when I launched the client I got the following error

ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
Aborted

Looks something to do with transport dt_socket. I have no understanding what it is and how to use another address for Client?

Edit 1

jetty-maven-plugin from pom.xml for client looks like this

<build>
    <plugins>

      <!-- Specific jetty-maven-plugin configuration for running Jetty during
        development. None of its goals are run in a normal build lifecycle. -->
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty-maven-plugin.version}</version>
        <configuration>
          <webAppConfig>
            <contextPath>/</contextPath>
            <extraClasspath>${basedir}/src/test/resources/</extraClasspath>
          </webAppConfig>
          <connectors>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
              <port>${servlet.port}</port>
              <host>0.0.0.0</host>
            </connector>
          </connectors>
          <reload>manual</reload>
          <useTestClasspath>true</useTestClasspath>
        </configuration>
      </plugin>
    </plugins>
  </build>

My assumption is some Jetty is starting in debug mode and trying to attach the debugger at port 8787 which is already bound to debugger of Server.

like image 970
Gaurav Agarwal Avatar asked Sep 06 '13 17:09

Gaurav Agarwal


2 Answers

Jetty does NOT automatically starts the debugger. You most likely have set the MAVEN_OPTS environment variable to include -Xdebug parameters. Check with 'echo $MAVEN_OPTS' and you will see something like:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

You can't run two maven processes which both try to debug on port 8787. So change your global MAVEN_OPTS (in .bash_profile when running on osx) or change your MAVEN_OPTS for your second terminal session:

export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512M"
like image 186
Gaurav Agarwal Avatar answered Nov 03 '22 14:11

Gaurav Agarwal


Enter the below command in terminal / command prompt

killall -9 java

It will kill all the java processes. You will be able to use the port then.

like image 27
Ashokchakravarthi Nagarajan Avatar answered Nov 03 '22 12:11

Ashokchakravarthi Nagarajan