【问题标题】:Port already in use with Docker-compose JAVA_TOOL_OPTIONS:已与 Docker-compose JAVA_TOOL_OPTIONS 一起使用的端口:
【发布时间】:2022-10-20 17:35:49
【问题描述】:

我试图在本地将 JMX 与 docker 连接,但获取端口已在使用中。我确实将端口号更改为不同的(未使用)。 任何人,请建议我的配置有什么问题。

docker-compose.yml:

version: "2"
services:
  app:
    extends:
      file: docker-compose.build.yml
      service: mvn
    ports:
      - "8080:8080"
      - "1099:1099"
    environment:
      JAVA_TOOL_OPTIONS: "-Djava.rmi.server.hostname=127.0.0.1 \
       -Dcom.sun.management.jmxremote.port=1099 \
       -Dcom.sun.management.jmxremote.rmi.port=1099 \
       -Dcom.sun.management.jmxremote.ssl=false \
       -Dcom.sun.management.jmxremote.authenticate=false"
    links:
      - activemq
    command: spring-boot:run
    env_file: .env
  activemq:
    ports:
      - "61616:61616"
      - "8161:8161"
Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
app_1       | Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 1099; nested exception is: 
app_1       |   java.net.BindException: Address in use
app_1       | jdk.internal.agent.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: 
app_1       |   java.net.BindException: Address in use
app_1       |   at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:492)
app_1       |   at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
app_1       |   at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
app_1       | Caused by: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: 

【问题讨论】:

    标签: java spring-boot docker jmx


    【解决方案1】:

    为了确保我将功劳归功于其他人,我在这里找到了这个问题的答案:

    https://devpress.csdn.net/cloudnative/63055d527e6682346619e0d7.html

    在 spring 可以运行之前,maven 命令本身正在窃取调试端口。

    【讨论】:

      猜你喜欢
      • 2020-06-26
      • 1970-01-01
      • 2019-12-25
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 1970-01-01
      • 2019-11-14
      相关资源
      最近更新 更多