gpt4 book ai didi

java - io.sentry.SentryClientFactory - 从 : 'https://public:private@host:port/1' 创建有效的 DSN 时出错

转载 作者:行者123 更新时间:2023-11-30 10:07:46 25 4
gpt4 key购买 nike

我是 Sentry 的新手,关注 this

and this

并按照相同的步骤和代码我有一个 sbt 项目,我在其中创建了 sentry.properties 文件,其内容是

dsn=https://public:private@host:port/1

并在抛出异常后运行代码时将其放置在 src/main/resources 下(与上面链接给出的代码相同)'

18:19:26.745 [run-main-1] DEBUG io.sentry.config.Lookup - Found dsn=https://public:private@host:port/1 in sentry.properties.
18:19:26.754 [run-main-1] ERROR io.sentry.SentryClientFactory - Error creating valid DSN from: 'https://public:private@host:port/1'.
io.sentry.dsn.InvalidDsnException: Invalid DSN, the following properties aren't set '[host, public key]'
at io.sentry.dsn.Dsn.validate(Dsn.java:209) ~[sentry-1.7.16.jar:na]
at io.sentry.dsn.Dsn.<init>(Dsn.java:66) ~[sentry-1.7.16.jar:na]
at io.sentry.dsn.Dsn.<init>(Dsn.java:41) ~[sentry-1.7.16.jar:na]
at io.sentry.SentryClientFactory.resolveDsn(SentryClientFactory.java:73) [sentry-1.7.16.jar:na]
at io.sentry.SentryClientFactory.sentryClient(SentryClientFactory.java:42) [sentry-1.7.16.jar:na]
at io.sentry.Sentry.init(Sentry.java:81) [sentry-1.7.16.jar:na]
at io.sentry.Sentry.init(Sentry.java:44) [sentry-1.7.16.jar:na]
at sentry.SentryDemo$.main(SentryDemo.scala:16) [classes/:na]
at sentry.SentryDemo.main(SentryDemo.scala) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at sbt.Run.invokeMain(Run.scala:67) [run-0.13.16.jar:0.13.16]
at sbt.Run.run0(Run.scala:61) [run-0.13.16.jar:0.13.16]
at sbt.Run.sbt$Run$$execute$1(Run.scala:51) [run-0.13.16.jar:0.13.16]
at sbt.Run$$anonfun$run$1.apply$mcV$sp(Run.scala:55) [run-0.13.16.jar:0.13.16]
at sbt.Run$$anonfun$run$1.apply(Run.scala:55) [run-0.13.16.jar:0.13.16]
at sbt.Run$$anonfun$run$1.apply(Run.scala:55) [run-0.13.16.jar:0.13.16]
at sbt.Logger$$anon$4.apply(Logger.scala:84) [logging-0.13.16.jar:0.13.16]
at sbt.TrapExit$App.run(TrapExit.scala:248) [run-0.13.16.jar:0.13.16]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
[error] (run-main-1) io.sentry.dsn.InvalidDsnException: Invalid DSN, the following properties aren't set '[host, public key]'
io.sentry.dsn.InvalidDsnException: Invalid DSN, the following properties aren't set '[host, public key]'
at io.sentry.dsn.Dsn.validate(Dsn.java:209)
at io.sentry.dsn.Dsn.<init>(Dsn.java:66)
at io.sentry.dsn.Dsn.<init>(Dsn.java:41)
at io.sentry.SentryClientFactory.resolveDsn(SentryClientFactory.java:73)
at io.sentry.SentryClientFactory.sentryClient(SentryClientFactory.java:42)
at io.sentry.Sentry.init(Sentry.java:81)
at io.sentry.Sentry.init(Sentry.java:44)
at sentry.SentryDemo$.main(SentryDemo.scala:16)
at sentry.SentryDemo.main(SentryDemo.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

我需要添加什么来代替属性文件中的 dsn 吗?我在我的项目中使用 Sentry ,这不是基于网络的项目

最佳答案

DSN 告诉 Sentry SDK 要命中哪个 Sentry 实例(例如 sentry.io)以及事件属于 Sentry 中的哪个项目。

您需要从 Sentry 获取 DSN 并添加到您的项目中。在 Sentry 中,在项目设置页面中,您将看到:Client keys (DSN):

Sentry Client keys menu

然后您将看到如下 DSN:

Example DSN

复制这个(右边的按钮),并粘贴到您的 sentry.properties 替换占位符:https://public:private@host:port/1

关于java - io.sentry.SentryClientFactory - 从 : 'https://public:private@host:port/1' 创建有效的 DSN 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54093129/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com