Null Poimter

2008-10-04
2013-03-25
  • Lakshmi Nadig

    Lakshmi Nadig - 2008-10-04

    I get this exception in my application after establishing a connection with YM.

    Exception in thread "Thread-1" java.lang.NullPointerException
        at com.itbs.aimcer.commune.ymsg.YMsgConnection.connectReal(YMsgConnection.java:139)
        at com.itbs.aimcer.commune.ymsg.YMsgConnection$1.run(YMsgConnection.java:111)

    What could the problem be?

     
    • Alex

      Alex - 2008-10-04

      Not sure how old your code is, but I don't see YMsgConnection.java:139 as a valid line of code for this repository.

      What's your YMsgConnection.java:139 ?
      Did you set all the things a connection needs to have to login? Username, password, properties etc?

       
    • Lakshmi Nadig

      Lakshmi Nadig - 2008-10-05

      that seems to be the the call to connectReal fromt he thread run method in connect().
      Yes, I have set the username , password and the eventHandler. Are there any other properties other than this?

              MessageSupport yconn = new YMsgConnection();
              yconn.setUserName(xxxx);
              yconn.setPassword(xxxx);
              connections.add(yconn);

                conn.assignGroupFactory(new GroupImplFactory());
              conn.assignContactFactory(new ContactImplFactory());
              conn.addEventListener(handler);
              conn.connect();

       
    • Alex

      Alex - 2008-10-05

      Unless you overwrote YMsgConnection, there is no way that line 139 blows up. Make sure you are not missing more stack trace lines.

      you also need to assign Properties to each connection.
      conn.setProperties(...).

       
      • Lakshmi Nadig

        Lakshmi Nadig - 2008-10-07

        No, we have not overridden YMsgConnection. Please point me to some examples/documentation of Connection.setProperties.

         
        • Alex

          Alex - 2008-10-07

          Main.java:
                      final WeatherConnection weather = new WeatherConnection();
                      weather.setProperties(ClientProperties.INSTANCE);

          Other setProperties are in:
          LoginPanel
          SaveFle

          LoginPanel is prolly your best choice to see how to create connections from scratch.

           
    • Lakshmi Nadig

      Lakshmi Nadig - 2008-10-15

      Hey Alex, Thanks for helping out. I checked out the latest sources and recompiled the whole code again. I find that the null pointer exception is becasue the getGroupList implementation in the factory class is returning null.
      1. IS there an example implementation for the GroupImplFactory class?
      2. Is there a default GroupImplFactory class in JClaim taht can be reused if we dont have any specific requirements on this GroupImplFactory class?
      Thanks,
      LAkshmi

       
      • Alex

        Alex - 2008-10-15

        Um, YES, take a look at the Main class.
        It's all inthere.
        Search for word GroupFactory, I think.

        I just moved those classes out into the bean package, but SVN is having issues (I think they moved the repositories wrong today). So I can't check it in at the moment.

         

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks