-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add new flag scan external jar package #416
Conversation
cli/cmd/prepare_jvm.go
Outdated
pc.command.Flags().StringVarP(&pc.javaHome, "javaHome", "j", "", "the java jdk home path") | ||
pc.command.Flags().StringVarP(&pc.chaosbaldeJarPath, "chaosbaldeJarPath", "jarPath", "", "the java jdk home path") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flag name is too long.
cli/cmd/prepare_jvm.go
Outdated
@@ -102,14 +105,14 @@ func (pc *PrepareJvmCommand) prepareJvm() error { | |||
"please append or modify the --port %s argument in prepare command for retry", record.Port)) | |||
} | |||
} | |||
response, username := jvm.Attach(record.Port, pc.javaHome, pc.processId) | |||
response, username := jvm.Attach(record.Port, pc.javaHome, pc.processId,pc.chaosbaldeJarPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format your codes.
exec/jvm/sandbox.go
Outdated
jvmOpts = fmt.Sprintf("-Xms128M -Xmx128M -Xnoclassgc -ea -Xbootclasspath/a:%s:%s", toolsJar, chaosbaldeJarPath) | ||
logrus.Printf("chaosblade jvmOpts:%s", jvmOpts) | ||
} else { | ||
jvmOpts = fmt.Sprintf("-Xms128M -Xmx128M -Xnoclassgc -ea -Xbootclasspath/a:%s:", toolsJar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An extra colon is written.
You can write in the following way:
jvmOpts = xxxx
if condition {
jvmOpts = fmt.Sprintf("%s:%s", jvmOpts, xxx)
}
panic: "jp" shorthand is more than one ASCII character goroutine 1 [running]: |
cli/cmd/prepare_jvm.go
Outdated
pc.command.Flags().StringVarP(&pc.javaHome, "javaHome", "j", "", "the java jdk home path") | ||
pc.command.Flags().StringVarP(&pc.chaosbladeJarPath, "jarPath", "jp", "", "the java jdk home path") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"jp" shorthand is more than one ASCII character
@cyemars This scheme seems not to work. -Xbootclasspath is only started for the JVM that loads the agent, not the JVM that affects the application |
Describe what this PR does / why we need it
解决Java工程无法调用外部jar 包
Does this pull request fix one issue?
添加flag 指定外部jar 包扫描路径
Describe how you did it
在agent挂载的时候传入jar包路径 扫描二方包