我正在尝试在我的 Mac OSX 机器上运行 jconsole,以便尝试分析应用程序中的一些内存泄漏问题。
jconsole 确实出现了,它确实列出了本地进程,但是当我尝试连接到本地进程时,连接就会超时。
我在这里找到了一些很好的故障排除建议: https ://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole
尽管此页面上的大多数链接现在不再有效。阅读这篇文章后,我使用这个命令运行了 jconsole,发现 jconsole 在尝试连接到我的本地进程时实际上会引发异常。
jconsole -J-Djava.security.debug=所有 2>&1 | 三通 /temp/log.txt
我可以看到这个异常跟踪,我将把它附加到这个问题的末尾,但我的问题是“我能做些什么来解决这个问题”?这台 Mac 是从另一个现已离开的开发人员那里继承来的,我真的很想尝试避免重新安装操作系统。这是一个例外,我希望对这个问题的任何回答都会对其他人有所帮助:
jar: computed ad8b34ed75936e2e0fb96b807980b012f0d56dc1
jar:
jar: beginEntry sun/security/pkcs11/wrapper/Functions$Flags.class
jar: Manifest Entry: sun/security/pkcs11/wrapper/Functions$Flags.class digest=SHA1
jar: manifest 752aaf83f970a47664b3722060cf048742854b68
jar: computed 752aaf83f970a47664b3722060cf048742854b68
jar:
cryptokiVersion: 2.20
manufacturerID: Apple
flags: 0
libraryDescription: Apple PKCS #11 module
libraryVersion: 0.01
All slots: 0, 1, 2, 3
Slots with tokens: (none)
ProviderConfig: Error loading provider sun.security.jca.ProviderConfig$4@31be0369
java.lang.UnsupportedOperationException: Initialization failed
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:337)
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:86)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at sun.security.jca.ProviderConfig$4.run(ProviderConfig.java:262)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:244)
at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:224)
at sun.security.jca.ProviderList.getProvider(ProviderList.java:215)
at sun.security.jca.ProviderList$3.get(ProviderList.java:130)
at sun.security.jca.ProviderList$3.get(ProviderList.java:125)
at java.util.AbstractList$Itr.next(AbstractList.java:345)
at java.security.SecureRandom.getPrngAlgorithm(SecureRandom.java:522)
at java.security.SecureRandom.getDefaultPRNG(SecureRandom.java:165)
at java.security.SecureRandom.<init>(SecureRandom.java:133)
at java.rmi.server.UID.<init>(UID.java:92)
at java.rmi.server.ObjID.<clinit>(ObjID.java:71)
at sun.rmi.transport.LiveRef.<init>(LiveRef.java:67)
at sun.rmi.server.UnicastServerRef2.<init>(UnicastServerRef2.java:51)
at sun.management.jmxremote.ConnectorBootstrap$PermanentExporter.exportObject(ConnectorBootstrap.java:171)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:84)
at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:75)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:388)
at sun.management.jmxremote.ConnectorBootstrap.startLocalConnectorServer(ConnectorBootstrap.java:475)
at sun.management.Agent.startAgent(Agent.java:135)
at sun.management.Agent.agentmain(Agent.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:325)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:348)
Caused by: java.security.ProviderException: slotListIndex is 0 but token only has 0 slots
at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:322)
... 33 more