Month: January 2012

com.sun.tools.attach.AttachNotSupportedException: no providers installed

如果你看到了这个异常: com.sun.tools.attach.AttachNotSupportedException: no providers installed, 十之八九是因为下面中的一个:   1. 你没有使用sun jdk   2. 你使用了sun jdk,并且JAVA_HOME指向了这个jdk,但是你的path下的"java"命令不是这个jdk里面的java,而是操作系统给你默认安装的jre下的,如c:\Program Files\java\….

认识了一个新朋友:JBoss Tattletale

它可以帮你解决以下问题:    1. You are faced with a lot of Java archives and you don’t know how they relate   2. You need to know in which archive(s) a class is located or if it is missing from the class-path   3.You need quick access to version identifiers and the OSGi status 比如说,要检查某个类是否存在于WEB-INF/lib下的多个jar文件中,就可以这个工具。 Tattletale可作为独立的命令行工具使用,也可以用作Maven插件。它还计划与Hudson集成。

[Maven]如果改变了所依赖工程的版本,则本工程的版本也应该修改

如果改变了所依赖工程的版本(修改本工程的pom.xml),则本工程的版本也应该修改; 因为   1.本工程已不是以前的那个工程了,应该有个新名字,即新的版本号   2.设本工程为B,它依赖了C,同时又被A依赖。原来B依赖C-1,现在依赖C-2。如果B的版本不改,则A在打包时就不会更新B及其依赖了的C,导致A仍然依赖C-1。 C的升级就不会让A受益

java instrument api倒底能不能给一个类添加新方法?

java instrument api倒底能不能给一个类添加新方法? 答: 这取决于这个类是否已经被定义过了。     1. 如果还没被定义,就可以,即使这个类是系统类;     2. 如果已经定义了,这时的修改就是二次插桩(retransform),二次插桩时可以修改方法体,但不允许加减方法。 官方文档说: 引用 The retransformation may change method bodies, the constant pool and attributes. The retransformation must not add, remove or rename fields or methods, change the signatures of methods, or change inheritance. These restrictions maybe be lifted in future versions. 不过要注意最后一句: These restrictions maybe …

java instrument api倒底能不能给一个类添加新方法? Read More »