Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 136
Registered: ‎03-04-2009
My Device: Not Specified

Getting device simulator connected to gmail

Hi, been sweating on this one for a while ... I have outlook express client connected to gmail fine, i.e. my laptop and the path to gmail are all good, no firewall/stingy provider issues etc..

 

I configured MDS/config/rimpublic property with same stuff as my outlook express but still MDS throws Java exception as follows ... any help is greatly appriciated, I think that the issue is that SSL or STARTTLS is not enaled on the MDS, but donno where/how ... thanks much, Udi

 

2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<LAYER = CMIME, EVENT =
Exception, javax.mail.MessagingException: Connect failed;
LAYER = CMIME, EVENT = Exception,   nested exception is:
LAYER = CMIME, EVENT = Exception,       java.net.ConnectException: Connection ti
med out: connect
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.pop3.POP3Store.protocolC
onnect(POP3Store.java:148)
LAYER = CMIME, EVENT = Exception,       at javax.mail.Service.connect(Service.ja
va:275)
LAYER = CMIME, EVENT = Exception,       at javax.mail.Service.connect(Service.ja
va:156)
LAYER = CMIME, EVENT = Exception,       at net.rim.protocol.cmimelayer.mailboxwa
tcher.e.Cg(Unknown Source)
LAYER = CMIME, EVENT = Exception,       at net.rim.protocol.cmimelayer.mailboxwa
tcher.e.run(Unknown Source)
LAYER = CMIME, EVENT = Exception, Caused by: java.net.ConnectException: Connecti
on timed out: connect
LAYER = CMIME, EVENT = Exception,       at java.net.PlainSocketImpl.socketConnec
t(Native Method)
LAYER = CMIME, EVENT = Exception,       at java.net.PlainSocketImpl.doConnect(Un
known Source)
LAYER = CMIME, EVENT = Exception,       at java.net.PlainSocketImpl.connectToAdd
ress(Unknown Source)
LAYER = CMIME, EVENT = Exception,       at java.net.PlainSocketImpl.connect(Unkn
own Source)
LAYER = CMIME, EVENT = Exception,       at java.net.SocksSocketImpl.connect(Unkn
own Source)
LAYER = CMIME, EVENT = Exception,       at java.net.Socket.connect(Unknown Sourc
e)
LAYER = CMIME, EVENT = Exception,       at java.net.Socket.connect(Unknown Sourc
e)
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.util.SocketFetcher.creat
eSocket(SocketFetcher.java:232)
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.util.SocketFetcher.getSo
cket(SocketFetcher.java:189)
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.pop3.Protocol.<init>(Pro
tocol.java:81)
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.pop3.POP3Store.getPort(P
OP3Store.java:201)
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.pop3.POP3Store.protocolC
onnect(POP3Store.java:144)
LAYER = CMIME, EVENT = Exception,       ... 4 more
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<javax.mail.MessagingExc
eption: Connect failed;
  nested exception is:
        java.net.ConnectException: Connection timed out: connect>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.pop3.PO
P3Store.protocolConnect(POP3Store.java:148)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at javax.mail.Service.c
onnect(Service.java:275)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at javax.mail.Service.c
onnect(Service.java:156)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at net.rim.protocol.cmi
melayer.mailboxwatcher.e.Cg(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at net.rim.protocol.cmi
melayer.mailboxwatcher.e.run(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<Caused by: java.net.Con
nectException: Connection timed out: connect>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at java.net.PlainSocket
Impl.socketConnect(Native Method)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at java.net.PlainSocket
Impl.doConnect(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at java.net.PlainSocket
Impl.connectToAddress(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at java.net.PlainSocket
Impl.connect(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at java.net.SocksSocket
Impl.connect(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at java.net.Socket.conn
ect(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at java.net.Socket.conn
ect(Unknown Source)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.util.So
cketFetcher.createSocket(SocketFetcher.java:232)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.util.So
cketFetcher.getSocket(SocketFetcher.java:189)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.pop3.Pr
otocol.<init>(Protocol.java:81)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.pop3.PO
P3Store.getPort(POP3Store.java:201)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.pop3.PO
P3Store.protocolConnect(POP3Store.java:144)>
<2009-03-23 21:57:04.225 EDT>:[50]:<MDS-CS_MDS>:<ERROR>:<... 4 more>
<2009-03-23 21:57:04.225 EDT>:[51]:<MDS-CS_MDS>:<ERROR>:<LAYER = CMIME, messagin
g exception>
<2009-03-23 21:57:04.225 EDT>:[52]:<MDS-CS_MDS>:<ERROR>:<LAYER = CMIME, EVENT =
Exception, javax.mail.MessagingException: Not connected
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.pop3.POP3Store.checkConn
ected(POP3Store.java:279)
LAYER = CMIME, EVENT = Exception,       at com.sun.mail.pop3.POP3Store.getFolder
(POP3Store.java:261)
LAYER = CMIME, EVENT = Exception,       at net.rim.protocol.cmimelayer.mailboxwa
tcher.e.run(Unknown Source)
<2009-03-23 21:57:04.225 EDT>:[52]:<MDS-CS_MDS>:<ERROR>:<javax.mail.MessagingExc
eption: Not connected>
<2009-03-23 21:57:04.225 EDT>:[52]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.pop3.PO
P3Store.checkConnected(POP3Store.java:279)>
<2009-03-23 21:57:04.225 EDT>:[52]:<MDS-CS_MDS>:<ERROR>:<at com.sun.mail.pop3.PO
P3Store.getFolder(POP3Store.java:261)>
<2009-03-23 21:57:04.225 EDT>:[52]:<MDS-CS_MDS>:<ERROR>:<at net.rim.protocol.cmi
melayer.mailboxwatcher.e.run(Unknown Source)>

 

 

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Getting device simulator connected to gmail

[ Edited ]

Have you noticed that gmail works with POP3 via port 995  ?

 

Perhaps you're connecting to a wrong port number.

Message Edited by tbilisoft on 24-03-2009 06:23 AM
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Getting device simulator connected to gmail

[ Edited ]

Check the image below, there are settings from my pop3-client mail application.

 

Message Edited by tbilisoft on 24-03-2009 06:37 AM
BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Getting device simulator connected to gmail

There is an issue with the current versions of the MDS Simulator that causes it to ignore the ports specified in the rimpublic.property file.  The default ports are always used.

 

You can use the ESS (Email Server Simulator) instead of the MDS Simulator if you need to connect using non default ports.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
Posts: 2
Registered: ‎04-21-2010
My Device: for help
My Carrier: etudiante

Consultation inbox

hello, I try to execute the java code Gpop, but there is a mistake, I can not see the box mail.L error is the following:
java.net.ConnectException: Connection timed out: connect

Please help me. thank you in advance


the code is as follows:


 

import java.util.*;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
//import java.sql.*;
public class Gpop extends JFrame
{
  class PopMessage {
    public String message;
    private String title;
    public PopMessage (String titleW, String msg)
    {
      title = titleW;
      message = msg;
    }
    public String toString()
    {
      return title;
    }
  }
  public class PopServerDialog extends JDialog
  {
    JTextField hostTF, portTF, userTF;
    JPasswordField passwordTF;
    public PopServerDialog(Frame parent, boolean modal)
    {
      super(parent, modal);
      JPanel panel1, panel2, panel3;
      JButton okButton, cancelButton;
      Container contentPane = this.getContentPane();
      panel1 = new JPanel();
      panel1.setLayout(new FlowLayout(FlowLayout.CENTER));
      contentPane.add(panel1, BorderLayout.SOUTH);
      okButton = new JButton("OK");
      panel1.add(okButton);
      cancelButton = new JButton("Cancel");
      panel1.add(cancelButton);
      panel3 = new JPanel();
      panel3.setLayout(new FlowLayout(FlowLayout.CENTER));
      contentPane.add(panel3, BorderLayout.CENTER);
      hostTF = new JTextField(popServer, 20);
      portTF = new JTextField("" + port, 5);
      panel3.add(new JLabel("Server"));
      panel3.add(hostTF);
      panel3.add(new JLabel("Port"));
      panel3.add(portTF);
      panel2 = new JPanel();
      panel2.setLayout(new FlowLayout(FlowLayout.CENTER));
      contentPane.add(panel2, BorderLayout.NORTH);
      userTF = new JTextField(user, 20);
      passwordTF = new JPasswordField(password, 10);
      panel2.add(new JLabel("User"));
      panel2.add(userTF);
      panel2.add(new JLabel("Passwd"));
      panel2.add(passwordTF);
      setTitle("Pop Server info");
      pack();
      cancelButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent event)
        {
          dispose();
          setVisible(false);
        }
      });
      okButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent event)
        {
          popServer = hostTF.getText();
          user = userTF.getText();
          password = new String(passwordTF.getPassword());
          port = Integer.parseInt(portTF.getText());
          dispose();
          setVisible(false);
        }
      });
    }
  }
  private String popServer = "pop.gmail.com";
  private String user = "jhjhjn" , password = "";
  private int port = 110;
  private JLabel status = new JLabel("Ready...");
  private JTextArea Jbody = new JTextArea(10,20);
  private Vector messages = new Vector();
  private JList msgList = new JList();
  public Gpop ()
  {
    JMenuBar menuBar = new JMenuBar();
    JPanel statusbar = new JPanel();
    JPanel Core = new JPanel();
    JScrollPane SPbody, SPlist;
    Core.setLayout(new BorderLayout());
    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    setJMenuBar(menuBar);
    JMenu fMenu = new JMenu("File");
    menuBar.add(fMenu);
    JMenuItem popServerItem = new JMenuItem("Set Pop Server", 2);
    fMenu.add(popServerItem);
    JMenuItem popMsgItem = new JMenuItem("Get Messages", 2);
    fMenu.add(popMsgItem);
    fMenu.addSeparator();
    JMenuItem exitItem = new JMenuItem("Exit", 2);
    fMenu.add(exitItem);
    statusbar.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
    statusbar.setBorder(new BevelBorder(BevelBorder.LOWERED));
    contentPane.add(statusbar,BorderLayout.SOUTH );
    statusbar.add(status);
    SPbody = new JScrollPane(Jbody,
                             JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                             JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    SPlist = new JScrollPane(msgList,
                             JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                             JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    Core.add(SPlist, BorderLayout.WEST);
    Core.add(SPbody, BorderLayout.EAST);
    contentPane.add(Core);
    // add listeners for the window and the various buttons
    this.addWindowListener( new WindowAdapter(){
         public void windowClosing(WindowEvent e){
              setVisible(false);
              dispose();
              System.exit(0);
    }});
    exitItem.addActionListener( new ActionListener(){
         public void actionPerformed(ActionEvent e){
              System.exit(0);
    }});
    popMsgItem.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
            getMessages();
    }});
    popServerItem.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
            changePopServer();
    }});
    msgList.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            int index = msgList.locationToIndex(e.getPoint());
            if ( index >= 0 && index < messages.size())
              Jbody.setText(((PopMessage)messages.elementAt(index)).message);
        }
    });
    pack();
  }
  protected void getMessages()
  {
      PrintWriter to;
      BufferedReader from;
      String str,title, msg;
      Vector v = new Vector();
      try {
        Socket socket = new Socket(InetAddress.getByName(popServer),port);
        to = new PrintWriter(
                    new BufferedWriter (
                        new OutputStreamWriter (
                            socket.getOutputStream())),true);
        from = new BufferedReader(
                   new InputStreamReader (
                            socket.getInputStream()));
        while ( ! (from.readLine()).startsWith("+OK") );
        to.println("USER "+user+"\r");
        while ( ! (from.readLine()).startsWith("+OK") );
        to.println("PASS "+password+"\r");
        while ( ! (from.readLine()).startsWith("+OK") );
        to.println("LIST\r");
        while ( ! (from.readLine()).startsWith("+OK") );
        do {
          str = from.readLine();
          if ( str.compareTo(".") != 0 ) v.add(str);
        } while ( str.compareTo(".") != 0 );
        for ( int i =0; i < v.size(); i++ ) {
          title = (String ) v.elementAt(i);
          to.println("RETR "+(new StringTokenizer(title)).nextToken()+"\r");
          while ( ! (from.readLine()).startsWith("+OK") );
          msg = "";
          do {
            msg += from.readLine() + "\n";
          } while ( ! msg.endsWith("\n.\n") );
          messages.add(new PopMessage(title, msg));
        }
        msgList.setListData(messages);
        status.setText("Ready ...");
        socket.close();
      } catch ( Exception e ) {System.err.println(e);}
  }
  protected void changePopServer()
  {
    new PopServerDialog(this, true).show();
  }
  public static void main ( String args[] )
  {
    (new Gpop()).setVisible(true);
  }
}

 

import java.util.*;

import java.awt.*;

import java.util.*;

import javax.swing.*;

import javax.swing.border.*;

import java.awt.event.*;

import java.io.*;

import java.net.*;


public class Gpop extends JFrame{

  class PopMessage {
    public String message;    private String title;
    public PopMessage (String titleW, String msg)  

 {      title = titleW;      message = msg;    }
    public String toString()    {      return title;    }
  }
  public class PopServerDialog extends JDialog  

{    JTextField hostTF, portTF, userTF;    JPasswordField passwordTF;
    public PopServerDialog(Frame parent, boolean modal)  

 {      super(parent, modal);
      JPanel panel1, panel2, panel3;    

 JButton okButton, cancelButton;
      Container contentPane = this.getContentPane();
      panel1 = new JPanel();      

panel1.setLayout(new FlowLayout(FlowLayout.CENTER));  

   contentPane.add(panel1, BorderLayout.SOUTH);    

 okButton = new JButton("OK");    

 panel1.add(okButton);    

 cancelButton = new JButton("Cancel");      

panel1.add(cancelButton);
      panel3 = new JPanel();    

 panel3.setLayout(new FlowLayout(FlowLayout.CENTER));      

contentPane.add(panel3, BorderLayout.CENTER);  

   hostTF = new JTextField(popServer, 20);    

 portTF = new JTextField("" + port, 5);    

 panel3.add(new JLabel("Server"));    

 panel3.add(hostTF);    

 panel3.add(new JLabel("Port"));    

 panel3.add(portTF);
      panel2 = new JPanel();    

 panel2.setLayout(new FlowLayout(FlowLayout.CENTER));    

 contentPane.add(panel2, BorderLayout.NORTH);    

 userTF = new JTextField(user, 20);    

 passwordTF = new JPasswordField(password, 10);      

panel2.add(new JLabel("User"));    

 panel2.add(userTF);  

   panel2.add(new JLabel("Passwd"));    

 panel2.add(passwordTF);
      setTitle("Pop Server info");    

 pack();



      cancelButton.addActionListener(new ActionListener()

{        public void actionPerformed(ActionEvent event)    

   {          dispose();      

   setVisible(false);      

 }      });
      okButton.addActionListener(new ActionListener()

{        public void actionPerformed(ActionEvent event)    

   {          popServer = hostTF.getText();        

 user = userTF.getText();        

 password = new String(passwordTF.getPassword());
          port = Integer.parseInt(portTF.getText());        

 dispose();      

   setVisible(false);        }      });
    }  }
  private String popServer = "pop.gmail.com";  

private String user = "jhjhjn" , password = "";  private int port = 110;
  private JLabel status = new JLabel("Ready..."); 

 private JTextArea Jbody = new JTextArea(10,20);  private Vector messages = new Vector();  

private JList msgList = new JList();
  public Gpop ()  {    JMenuBar menuBar = new JMenuBar();
    JPanel statusbar = new JPanel();    JPanel Core = new JPanel();  

 JScrollPane SPbody, SPlist;
    Core.setLayout(new BorderLayout());
    Container contentPane = this.getContentPane(); 

   contentPane.setLayout(new BorderLayout());
    setJMenuBar(menuBar);
    JMenu fMenu = new JMenu("File");  

 menuBar.add(fMenu);
    JMenuItem popServerItem = new JMenuItem("Set Pop Server", 2);  

 fMenu.add(popServerItem);    JMenuItem popMsgItem = new JMenuItem("Get Messages", 2);  

 fMenu.add(popMsgItem);    fMenu.addSeparator();  

 JMenuItem exitItem = new JMenuItem("Exit", 2);    

fMenu.add(exitItem);
    statusbar.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));  

 statusbar.setBorder(new BevelBorder(BevelBorder.LOWERED));

    contentPane.add(statusbar,BorderLayout.SOUTH );    

statusbar.add(status);

    SPbody = new JScrollPane(Jbody, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,                             JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);    SPlist = new JScrollPane(msgList,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,                          JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    Core.add(SPlist, BorderLayout.WEST);  

 Core.add(SPbody, BorderLayout.EAST);
    contentPane.add(Core);

    // add listeners for the window and the various buttons  

 this.addWindowListener( new WindowAdapter()

{         public void windowClosing(WindowEvent e)

{              setVisible(false);          

   dispose();          

   System.exit(0);    }});
    exitItem.addActionListener( new ActionListener()

{         public void actionPerformed(ActionEvent e)

{              System.exit(0);    }});
    popMsgItem.addActionListener(new ActionListener()

{            public void actionPerformed(ActionEvent e){            getMessages();    }});
    popServerItem.addActionListener(new ActionListener()

{ public void actionPerformed(ActionEvent e){            changePopServer();    }});
    msgList.addMouseListener(new MouseAdapter()

{        public void mouseClicked(MouseEvent e)

{            int index = msgList.locationToIndex(e.getPoint());        

   if ( index >= 0 && index < messages.size())              Jbody.setText(((PopMessage)messages.elementAt(index)).message);        }    });
    pack();
  }
  protected void getMessages() 

 {      PrintWriter to;    

 BufferedReader from;  

   String str,title, msg;    

 Vector v = new Vector();
      try {        Socket socket = new Socket(InetAddress.getByName(popServer),port);
        to = new PrintWriter(                    new BufferedWriter (  new OutputStreamWriter (                            socket.getOutputStream())),true);      

 from = new BufferedReader(  new InputStreamReader (  socket.getInputStream()));
        while ( ! (from.readLine()).startsWith("+OK") );        

to.println("USER "+user+"\r");      

 while ( ! (from.readLine()).startsWith("+OK") );      

 to.println("PASS "+password+"\r");      

 while ( ! (from.readLine()).startsWith("+OK") );
        to.println("LIST\r");      

 while ( ! (from.readLine()).startsWith("+OK") );        

do {          str = from.readLine();      

   if ( str.compareTo(".") != 0 ) v.add(str);        }

while ( str.compareTo(".") != 0 );
        for ( int i =0; i < v.size(); i++ ) {          title = (String ) v.elementAt(i);      

   to.println("RETR "+(new StringTokenizer(title)).nextToken()+"\r");          

while ( ! (from.readLine()).startsWith("+OK") );          msg = "";      

   do {            msg += from.readLine() + "\n";          }

while ( ! msg.endsWith("\n.\n") );        

 messages.add(new PopMessage(title, msg));        }
        msgList.setListData(messages);
        status.setText("Ready ...");
        socket.close();
      } catch ( Exception e ) {System.err.println(e);}

  }
  protected void changePopServer() 

 {    new PopServerDialog(this, true).show();  }
  public static void main ( String args[] )  {    (new Gpop()).setVisible(true);
  }
}

New Contributor
Posts: 2
Registered: ‎04-21-2010
My Device: for help
My Carrier: etudiante

Re: Consultation inbox

Please help me. Smiley Sad