Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

com.sun.tools.attach.AgentLoadException: Unable to add JAR file to system class path #76

Open
xumingming opened this issue Aug 15, 2012 · 9 comments

Comments

@xumingming
Copy link

error log:

INFO : load agent /Users/xumingmingv/bin/housemd.jar
INFO : options:
INFO :  /Users/xumingmingv/bin/housemd.jar
INFO :  com.github.zhongl.housemd.Telephone
INFO :  54321
INFO :  com.github.zhongl.housemd.Trace
INFO :  com.github.zhongl.housemd.Loaded
ERROR: com.sun.tools.attach.AgentLoadException: Unable to add JAR file to system class path
ERROR: You can get more details in /tmp/housemd.err.89357

content of /tmp/housemd.err.89537:

sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:101)
com.github.zhongl.housemd.HouseMD$.run(HouseMD.scala:72)
com.github.zhongl.yascli.Application$class.main(Application.scala:29)
com.github.zhongl.housemd.HouseMD$.main(HouseMD.scala:29)
com.github.zhongl.housemd.HouseMD.main(HouseMD.scala)
@zhongl
Copy link
Member

zhongl commented Aug 15, 2012

你是不是用JDK 7了?

你再用HouseMD最新的版本, 也就是0.2.3试试, 看问题是不是一样的?

@xumingming
Copy link
Author

还是不行:

xumingmingv:bin$ housemd 90067
INFO : Welcome to HouseMD 0.2.3
ERROR: com.sun.tools.attach.AgentLoadException: Unable to add JAR file to system class path
ERROR: You can get more details in /tmp/housemd.err.90067
sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:101)
com.github.zhongl.housemd.house.House$.run(House.scala:87)
com.github.zhongl.yascli.Application$class.main(Application.scala:29)
com.github.zhongl.housemd.house.House$.main(House.scala:34)
com.github.zhongl.housemd.house.House.main(House.scala)

JDK版本:

xumingmingv:bin$ java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-12A269)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

@xumingming
Copy link
Author

不是所有java进程都不行,是否个特定的线程不行, 对了这个特定的进程我指定了java.system.class.loader, 不知道有没有关系。

@xumingming
Copy link
Author

能确定了,是我设定的系统类加载器不支持动态添加JAR包:

System class loader does not support adding JAR file to system class path during the live phase!
Unable to add /Users/xumingmingv/bin/housemd.jar to system class path - not supported by system class loader or configuration error!

@zhongl
Copy link
Member

zhongl commented Aug 16, 2012

怎么设定系统类加载不支持动态添加JAR包?

@xumingming
Copy link
Author

我的系统类加载器是我自己写的一个类加载器(继承URLClassLoader), 其实我想知道的是怎么让自己写的类加载器支持动态添加JAR包 =_=

@zhongl
Copy link
Member

zhongl commented Aug 16, 2012

代码发来看看, 我很好奇你怎么写的!

@xumingming
Copy link
Author

看这里: https://gist.github.com/3365260

@zhongl
Copy link
Member

zhongl commented Aug 16, 2012

呃, 我看不出来什么问题导致HouseMD 加载agent失败啊?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants