title: Exception on MQTT Client connect on Java ME
body: <p>I'm trying to connect Java ME App Client to a MQTT broker.
  I'm able to create a Client, cross checked client Server URI
  But when I tried to connect then I see exception:</p>
  
  <p>Here is the code:</p>
  
  <pre><code>try {
      myClient = new MqttClient(BROKER_URL, MqttClient.generateClientId()); //, new MemoryPersistence());
  
                  if(myClient == null)
                  {
                      System.out.println("myClient = NULL");
                      return;
                  }
                  System.out.println("ServerURI: "+myClient.getServerURI());
                 System.out.println("is Connected: "+myClient.isConnected());
  
  
                   System.out.println("Setting Call back");
      myClient.setCallback(new MqttCallback() {
  
                      @Override
                      public void connectionLost(Throwable cause) {
                          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                      }
  
                      @Override
                      public void messageArrived(String topic, MqttMessage message) throws Exception {
                           // String payload = new String(message.getPayload());
                          System.out.println(topic+ "---&gt;"+ new String(message.getPayload()));
                          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  
                      }
  
                      @Override
                      public void deliveryComplete(IMqttDeliveryToken token) {
                          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                      }
                  });
  
  
                   System.out.println("Trying to Connect to BROKER");
      myClient.connect(); 
                  //  myClient.connect(connOpt);
                  System.out.println("Subscribing to WORLD TOPIC");
                  myClient.subscribe("world");
  } catch (MqttException e) {
  
              System.out.println("--- Caught Exception ---");
             // System.out.println("Exception: "+e.toString());
      e.printStackTrace();
      System.exit(-1);
              return;
  }
  </code></pre>
  
  <p>I get and exception on connect. here is the exception:</p>
  
  <pre><code> java.lang.NullPointerException
   - org/eclipse/paho/client/mqttv3/internal/MessageCatalog.getMessage(MessageCatalog.java:46)
   - org/eclipse/paho/client/mqttv3/MqttException.getMessage(MqttException.java:200)
   - org/eclipse/paho/client/mqttv3/MqttException.toString(MqttException.java:208)
   - java/lang/String.valueOf(), bci=11
   - java/io/PrintStream.print(), bci=2
   - java/io/PrintStream.println(), bci=2
   - java/lang/Throwable.printStackTrace(), bci=2
   - java/lang/Throwable.printStackTrace(), bci=4
   - javameapp82/SimpleMqttClient.testMQTTClient(SimpleMqttClient.java:96)
   - javameapp82/JavaMEApp82.startApp(JavaMEApp82.java:50)
   - javax/microedition/midlet/MIDletTunnelImpl.callStartApp(), bci=1
   - com/sun/midp/midlet/MIDletPeer.startApp(), bci=5
   - com/sun/midp/midlet/MIDletStateHandler.startSuite(), bci=264
   - com/sun/midp/main/AbstractMIDletSuiteLoader.startSuite(), bci=38
   - com/sun/midp/main/CldcMIDletSuiteLoader.startSuite(), bci=5
   - com/sun/midp/main/AbstractMIDletSuiteLoader.runMIDletSuite(), bci=132
   - com/sun/midp/main/AppIsolateMIDletSuiteLoader.main(), bci=26
  </code></pre>
  
  <p>Not sure why I get this exception, Thanks for the help.</p>