gpt4 book ai didi

java - 在服务器上使用 Smack 时如何避免 HeadlessException?

转载 作者:行者123 更新时间:2023-12-02 05:48:28 24 4
gpt4 key购买 nike

我下载了 Smack 示例代码,用于将 GCM 从服务器发送到 Android 设备。

当我在我的开发机器上运行它时,我会看到一个 Smack 调试窗口。

在我的服务器上我得到这个:

Exception in thread "Thread-6" java.lang.IllegalArgumentException: Can't initialize the configured debugger! at org.jivesoftware.smack.Connection.initDebugger(Connection.java:797) at org.jivesoftware.smack.XMPPConnection.initReaderAndWriter(XMPPConnection.java:731) at org.jivesoftware.smack.XMPPConnection.initConnection(XMPPConnection.java:611) at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:596) at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1010) at se.wi.poc.brdgms.utils.Android.connect(Android.java:94) at se.wi.poc.brdgms.utils.Android.push(Android.java:50) at se.wi.poc.brdgms.utils.PushUtils.pushToUserInSeparateThread(PushUtils.java:30) at se.wi.poc.brdgms.utils.PushUtils.access$0(PushUtils.java:26) at se.wi.poc.brdgms.utils.PushUtils$1.run(PushUtils.java:20) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:534) at org.jivesoftware.smack.Connection.initDebugger(Connection.java:792) ... 9 more Caused by: java.awt.HeadlessException at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173) at java.awt.Window.(Window.java:547) at java.awt.Frame.(Frame.java:419) at javax.swing.JFrame.(JFrame.java:218) at org.jivesoftware.smack.debugger.LiteDebugger.createDebug(LiteDebugger.java:65) at org.jivesoftware.smack.debugger.LiteDebugger.(LiteDebugger.java:58) ... 14 more

如何禁用 Smack 调试窗口?

最佳答案

我走后

    myConfig = new ConnectionConfiguration(SERVER, PORT);

我得走了

    myConfig.setDebuggerEnabled(false);

关于java - 在服务器上使用 Smack 时如何避免 HeadlessException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23804459/

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