传输dt_socket 8787已在使用中

Gau*_*wal 5 java jetty maven maven-jetty-plugin

我试图在我的Ubuntu 12.04机器上运行Jetty服务器中的服务器和客户端应用程序.服务器启动没有任何问题,我使用以下命令

$ mvn码头:跑

在发出这个命令时,第一行是

在地址:8787收听传输dt_socket

但是当我启动客户端时,我收到以下错误

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
Run Code Online (Sandbox Code Playgroud)

看起来与传输dt_socket有关.我不明白它是什么以及如何为客户使用另一个地址?

编辑1

来自pom.xml的客户端的jetty-maven-plugin看起来像这样

<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>
Run Code Online (Sandbox Code Playgroud)

我的假设是一些Jetty正在调试模式下启动并尝试将调试器连接到端口8787,该端口已经绑定到Server的调试器.

Ash*_*jan 9

在terminal/command提示符下输入以下命令

killall -9 java

它会杀死所有java进程.然后您就可以使用该端口了.


Gau*_*wal 8

Jetty不会自动启动调试器.您很可能已将MAVEN_OPTS环境变量设置为包含-Xdebug参数.查看'echo $ MAVEN_OPTS',你会看到类似的东西:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
Run Code Online (Sandbox Code Playgroud)

您无法运行两个尝试在端口8787上进行调试的maven进程.因此,更改全局MAVEN_OPTS(在osx上运行时在.bash_profile中)或更改第二个终端会话的MAVEN_OPTS:

export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512M"
Run Code Online (Sandbox Code Playgroud)