[英]Configuring Glowroot with tomcat temp folder locked shows following exception
我正在客户端Tomcat上配置Glowroot代理,出于安全原因,我们仅提供对Tomcat临时目录的读取访问权限,glowroot-> tcnative-> netty用于在Tomcat临时目录中创建临时文件并在成功执行后将其删除,限制访问临时文件夹,我得到了这个例外。 如果我提供对Tomcat临时文件夹的rwx
访问,则一切正常。
java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
at org.glowroot.agent.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:258)
at org.glowroot.agent.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at org.glowroot.agent.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:120)
at org.glowroot.agent.central.CentralConnection.<init>(CentralConnection.java:125)
at org.glowroot.agent.central.CentralCollector.<init>(CentralCollector.java:135)
at org.glowroot.agent.init.NonEmbeddedGlowrootAgentInit$1.run(NonEmbeddedGlowrootAgentInit.java:136)
at org.glowroot.agent.impl.BytecodeServiceImpl.enteringMainMethod(BytecodeServiceImpl.java:255)
at org.glowroot.agent.impl.BytecodeServiceImpl.enteringMainMethod(BytecodeServiceImpl.java:77)
at org.glowroot.agent.bytecode.api.Bytecode.enteringMainMethod(Bytecode.java:32)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java)
根据文档,我们可以通过vm参数-Dio.netty.native.workdir=/some/dir
来设置netty tmp目录,但是在运行时,它不按照io.netty.util.internal.PlatformDependent
的代码跳回tomcat temp,因此io.netty.util.internal.PlatformDependent
private static File tmpdir0() {
File f;
try {
f = toDirectory(SystemPropertyUtil.get("io.netty.tmpdir"));
if (f != null) {
logger.debug("-Dio.netty.tmpdir: {}", f);
return f;
}
f = toDirectory(SystemPropertyUtil.get("java.io.tmpdir"));
if (f != null) {
logger.debug("-Dio.netty.tmpdir: {} (java.io.tmpdir)", f);
return f;
}
// This shouldn't happen, but just in case ..
if (isWindows()) {
f = toDirectory(System.getenv("TEMP"));
if (f != null) {
logger.debug("-Dio.netty.tmpdir: {} (%TEMP%)", f);
return f;
}
String userprofile = System.getenv("USERPROFILE");
if (userprofile != null) {
f = toDirectory(userprofile + "\\AppData\\Local\\Temp");
if (f != null) {
logger.debug("-Dio.netty.tmpdir: {} (%USERPROFILE%\\AppData\\Local\\Temp)", f);
return f;
}
f = toDirectory(userprofile + "\\Local Settings\\Temp");
if (f != null) {
logger.debug("-Dio.netty.tmpdir: {} (%USERPROFILE%\\Local Settings\\Temp)", f);
return f;
}
}
} else {
f = toDirectory(System.getenv("TMPDIR"));
if (f != null) {
logger.debug("-Dio.netty.tmpdir: {} ($TMPDIR)", f);
return f;
}
}
} catch (Throwable ignored) {
// Environment variable inaccessible
}
// Last resort.
if (isWindows()) {
f = new File("C:\\Windows\\Temp");
} else {
f = new File("/tmp");
}
logger.warn("Failed to get the temporary directory; falling back to: {}", f);
return f;
}
如何强制设置Netty tmp目录?
试试这个-Dorg.glowroot.agent.shaded.io.netty.tmpdir="your\\path"
参数-Dorg.glowroot.agent.shaded.io.netty.tmpdir="your\\path"
Netty事先在jre库中查找库,因此在正常情况下,如果DLL在jre / libs /内部具有以下指定的名称可用,它将被加载
"netty_tcnative_[os.name]_[os.arch].dll"(windows)
要么
"netty_tcnative_[os.name]_[os.arch].so"(linux)
检查您的os.name和os.arch以替换lib name中的最后一个后缀
如果将netty服务用作超级jar,请检查要附加的阴影程序包名称,对于glowroot,它将为org_glowroot_agent_shaded_netty_tcnative_windows_x86_64.dll
*对于Windows 8.1或更高版本的os.name可能无法按预期工作,请参阅Windows 10的Java“ os.name”?
要查找os.name和os.arch,请执行以下代码
SystemPropertyUtil.get("os.name")
SystemPropertyUtil.get("os.arch")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.