简体   繁体   English

Smack 异常 - 由我的 Java 安装或 Smack 引起

[英]Smack Exception - caused by my Java installation or by Smack

I'm using Smack API to develop a multi-user gaming client.我正在使用 Smack API 开发多用户游戏客户端。 I've got a problem with my smack application: i can send messages and requests to the server, but my application can't read responses from it.我的 smack 应用程序有问题:我可以向服务器发送消息和请求,但我的应用程序无法读取它的响应。

Exception in thread "Smack Packet Reader (0)" java.lang.ExceptionInInitializerError
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:169)
          at org.jivesoftware.smack.provider.ProviderManager.initialize(ProviderManager.java :193)
          at org.jivesoftware.smack.provider.ProviderManager.<init>(ProviderManager.java:436 )
          at org.jivesoftware.smack.provider.ProviderManager.getInstance(ProviderManager.jav a:134)
          at org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:30 3)
          at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:229)
          at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
          at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Caused by: java.lang.NullPointerException
          at java.util.TimeZone.parseCustomTimeZone(TimeZone.java:767)
          at java.util.TimeZone.getTimeZone(TimeZone.java:471)
          at java.util.TimeZone.getTimeZone(TimeZone.java:465)
          at org.jivesoftware.smackx.workgroup.packet.TranscriptsProvider.<clinit>(Transcrip tsProvider.java:44)
          ... 9 more
No response from the server.:

It's not a network (firewall, nat...) problem (on another Macintosh in the same subnet, the same code runs well with no exceptions).这不是网络(防火墙、nat ...)问题(在同一子网中的另一台 Macintosh 上,相同的代码运行良好,没有例外)。 I checked my MacOS firewall and it seems ok...what can I do to resolve this issue?我检查了我的 MacOS 防火墙,它似乎没问题...我可以做些什么来解决这个问题? I don't know if this issue depends on java or Smack... Thanks in advance.我不知道这个问题是否取决于 java 或 Smack ...提前致谢。

This more of a continuation of the comments rather than a complete answer (but hopefully it helps).这更多是评论的延续,而不是完整的答案(但希望它有所帮助)。

The offending line in the java source reads zi.setID("GMT+00:00"); java 源代码中的违规行读取zi.setID("GMT+00:00"); . . zi is of type sun.util.calendar.ZoneInfo . zi 是sun.util.calendar.ZoneInfo类型。 This can only mean that zi is null .这只能意味着 zi 是null Further up it is being created as follows:进一步创建如下:

zi = ZoneInfoFile.getZoneInfo("GMT");

So I wrote the following little test program:所以我写了下面的小测试程序:

class Foobar {
    public static void main(String[] args) {
        sun.util.calendar.ZoneInfo zi = sun.util.calendar.ZoneInfoFile.getZoneInfo("GMT");
        zi.setID("GMT+00:00:00");
    }
}

I didn't get any NullPointerException or any other type of exception.我没有得到任何NullPointerException或任何其他类型的异常。 Perhaps you could run the same test program and see what happens.也许您可以运行相同的测试程序,看看会发生什么。 My guess is that it will fail for you.我的猜测是它会为你失败。 It might indicate a borked Java installation.它可能表明 Java 安装失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM