docker启动openjdk后,可以查看进程

# docker exec -it XXX jps

10 XXX.jar

可见启动的java进程id一直为10,然后可以执行jvm命令,比如

# docker exec -it XXX jstack 10

# docker exec -it XXX jstat -gcutil 10

# docker exec -it XXX jmap -histo 10

但是执行jmap -heap或者-dump时会报错:

Attaching to process ID 10, please wait...
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 10: Operation not permitted
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 10: Operation not permitted
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:163)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:278)
at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:671)
at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.tools.jmap.JMap.runTool(JMap.java:201)
at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 10: Operation not permitted
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$100(LinuxDebuggerLocal.java:62)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1AttachTask.doit(LinuxDebuggerLocal.java:269)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:138)

这是因为docker禁用了ptrace,

1)如果手工通过docker命令启动,增加参数

# docker run --cap-add SYS_PTRACE ...

2)如果通过marathon启动

然后问题修复

【原创】大叔经验分享(89)docker启动openjdk执行jmap报错的更多相关文章

  1. 【原创】大叔经验分享(49)hue访问hdfs报错/hue访问oozie editor页面卡住

    hue中使用hue用户(hue admin)访问hdfs报错: Cannot access: /. Note: you are a Hue admin but not a HDFS superuser ...

  2. 【原创】大叔经验分享(11)python引入模块报错ImportError: No module named pandas numpy

    python应用通常需要一些库,比如numpy.pandas等,安装也很简单,直接通过pip # pip install numpyRequirement already satisfied: num ...

  3. 【原创】大叔经验分享(38)beeline连接hiveserver2报错impersonate

    beeline连接hiveserver2报错 Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost: ...

  4. 【原创】大叔经验分享(31)CM金丝雀Canary报错

    CM金丝雀Canary报错 1 HDFS 金丝雀Canary 测试无法为 /tmp/.cloudera_health_monitoring_canary_files 创建父目录. 2 Hive Met ...

  5. 【原创】大叔经验分享(52)ClouderaManager修改配置报错

    Cloudera Manager中修改配置可能报错: Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'MESSAGE ...

  6. 【原创】大叔经验分享(55)spark连接kudu报错

    spark-2.4.2kudu-1.7.0 开始尝试 1)自己手工将jar加到classpath spark-2.4.2-bin-hadoop2.6+kudu-spark2_2.11-1.7.0-cd ...

  7. 【原创】大叔经验分享(43)logstash设置jdbc_default_timezone后报错

    logstash6.6.0-6.6.2版本使用jdbc input plugin时如果设置了jdbc_default_timezone,会报错: { 2012 rufus-scheduler inte ...

  8. Docker 启动容器时,报错 WARNING:IPv4 forwarding is disabled. Networking will not work. 的解决办法

    Centos 7 Docker 启动了一个web服务 但是启动时 报 WARNING: IPv4 forwarding is disabled. Networking will not work. 解 ...

  9. [转] node升级到8.0.0在vscode启动js执行文件报错

    由于升级node 到 8.0.0 版本 vscode 启动一直报错: `node --debug` and `node --debug-brk` are invalid. Please use `no ...

随机推荐

  1. JMeter中计数器的使用

    添加计数器 计数器的引用,用于数据做区分 可以添加一个变量count,每次为了数据的唯一性,只要修改count就可以了,例如

  2. How can I get a Netty server to reload a TLS certificate when it is renewed?

    java - How can I get a Netty server to reload a TLS certificate when it is renewed? - Stack Overflow ...

  3. OpenSL ES: OpenSL ES 简介

    1. OpenSL ES 是什么 OpenSL ES (Open Sound Library for Embedded Systems)是无授权费.跨平台.针对嵌入式系统精心优化的硬件音频加速API. ...

  4. Team团队管理执行力

    执行力是什么_百度知道https://zhidao.baidu.com/question/144991863.html [图文]如何提高团队执行力 - 百度文库https://wenku.baidu. ...

  5. react图片自适应组件

    import * as React from 'react'; import 'animate.css/animate.css' import {AutoImg} from "./style ...

  6. js的Map实例

    1.创建实例 let map= new Map(); // 创建 2.对map的写入 // 要添加的对象 let obj1 = {name:'张三', sex:'boy',age: 21}; let ...

  7. Mysql字段修饰符(约束)

    (1).null和not null not null不可以插入null,但可以插入空值. 数值型.字符型.日期型都可以插入null,但只有字符型可以插入空值. 使用方法如下: mysql> cr ...

  8. Mysql的安全配置向导命令mysql_secure_installation

    mysql_secure_installation安全配置向导 [root@youxi1 ~]# mysql_secure_installation Securing the MySQL server ...

  9. 123457123457#0#-----com.threeapp.PaoPaoLong01-----泡泡龙大作战01

    com.threeapp.PaoPaoLong01-----泡泡龙大作战01

  10. ABAP Memory ID

    转自:https://blog.csdn.net/lyq123333321/article/details/52659114 (一)          Difference Between SAP a ...