Closed xwshiustc closed 6 years ago
@xwshiustc 能否说明一下: JBoss
设置-xbootclasspath
且生效,需要的哪些具体操作 及相关的资料?
原因:
-xbootclasspath
)实现后,设置-xbootclasspath
也是一条路子,可以根据实际的场景需求来选用。目前我只有用过JBoss 6
和tomcat 6
在JBoss 6.x
的大部分版本中 配置方式为:
-javaagent:/opt/xxxxxx/transmittable-thread-local-2.x.x.jar
-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager,com.alibaba.ttl,
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Xbootclasspath/p:/opt/xxxxxx/transmittable-thread-local-2.x.x.jar
-Djboss.modules.system.pkgs
是所有的加入 xbootclasspath
下面的类的包名都需要配置。
jboss自带的两个包也需要配置, 但是如果不引入任何第三方的jar进入jboss xbootclasspath
,则都不需要配置xbootclasspath
以后也需要配置,否则会报LogManager ClassNotFound
tomcat 6
开发环境中使用很简单,不需要配置任何其他参数。
只要 -javaagent:/opt/xxxxxx/transmittable-thread-local-2.x.x.jar
即可
建议不要使用MANIFEST.MF
中的Boot-Class-Path
代替-Xbootclasspath/a
,否则修改了ttl的jar包名称,仍然需要指定参数-Xbootclasspath/a
。
附上Boot-Class-Path
的说明:
A list of paths to be searched by the bootstrap class loader. Paths represent directories or libraries (commonly referred to as JAR or zip libraries on many platforms). These paths are searched by the bootstrap class loader after the platform specific mechanisms of locating a class have failed. Paths are searched in the order listed. Paths in the list are separated by one or more spaces. A path takes the syntax of the path component of a hierarchical URI. The path is absolute if it begins with a slash character ('/'), otherwise it is relative. A relative path is resolved against the absolute path of the agent JAR file. Malformed and non-existent paths are ignored. When an agent is started sometime after the VM has started then paths that do not represent a JAR file are ignored. This attribute is optional.
@baifan
Boot-Class-Path
简化 -Xbootclasspath
的配置是Agent
的最佳实践。 Jar
文件名。-Xbootclasspath
的配置,就像之前的版本一样。另外,你提的注意点在文档中已经加上明确说明了 ❤️ 👍
根据本人使用经验
-xbootclasspath
在各个容器中需要配置额外的参数,调研起来会很麻烦JBoss 6.2
以上版本中,如果使用了-xbootclasspath
,需要配置额外的启动参数java -Dxxxxx=xxxxxxxx
参数等等才可以真正起作用,每种容器的实现都不一样相当棘手,甚至JBoss6.2
和其以下的其他版本参数也不同,未来我将努力贡献一部分代码争取不再配置需要配置
-xbootclasspath
。