Hi Addy ,
I have written following method to connect to messaging server.
with this method I'm able to connect to messaging server if the messaging server  and  my program is on localhost(shilpa).
 
public void setUp(String login,String password)
{ Properties prop;
    String messagingServer = "shilpa";
    String login = null ;
    String password = null; ;
    static private Store store = null;
    static private Session session = null;

  try{
     this.login=login;
     this.password = password;
   prop = System.getProperties();
   prop.put("mail.transport.protocol", "smtp");
   prop.put("mail.from", login + "@" + messagingServer);
   session = Session.getInstance(prop, null);
   store = session.getStore(new URLName("imap",messagingServer, 143, null,login, password));
   store.connect();
   System.out.println("messaging server is connected");
      }  catch(Exception e)
   {
   System.out.println("Messaging server connection is failed");
      e.printStackTrace();
   }
 
 }
 
now with same programm I'm trying to connect to messaging server remotely then
it gives following error at runtime,
 
javax.mail.MessagingException: Connection refused;
  nested exception is:
        java.net.ConnectException: Connection refused
        at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:298)
        at javax.mail.Service.connect(Service.java:234)
        at javax.mail.Service.connect(Service.java:135)
        at javax.mail.Service.connect(Service.java:87)
        at FolderSupport.Foldering.setUp(Foldering.java:60)
        at FolderSupport.Foldering.main(Foldering.java:427)
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/Data
Source
        at FolderSupport.Foldering.main(Foldering.java:444)
 
how to get out of this error ????????
 
 

Reply via email to