Search code examples
javaexceptionxmppsmack

Smack Exception - caused by my Java installation or by Smack


I'm using Smack API to develop a multi-user gaming client. 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.

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). I checked my MacOS firewall and it seems ok...what can I do to resolve this issue? I don't know if this issue depends on java or Smack... Thanks in advance.


Solution

  • 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");. zi is of type sun.util.calendar.ZoneInfo. This can only mean that zi is 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. 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.