Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Error while connecting to inbox using java mail


Message #1 by "Sudhakar Reddy Konda" <ksreddy123@y...> on Wed, 19 Jun 2002 20:58:29
Hello,

I unjar the mail.jar file and place in the lib folder. Then also i am 
getting the same error.


Regards
SRK



> Hello,
 >  It looks to me, you're missing your javamail.providers and 
j> avamail.address.map file. These two files should be in:

> JAVA_HOME/lib/

> OR

> META-INF/

> 
T> his file comes with your mail.jar file. So, you should unjar your 
m> ail.jar file and you will find:

> javamail.default.address.map
j> avamail.default.providers

> copy them to your JAVA_HOME/lib  and rename them as

> javamail.providers
j> avamail.address.map

> 
n> o need to edit this file, unless your writing your own service 
providers. 
Y> our application can not find the service providers. 

> regards,

> 

> 
>>  Hi There,

> > I am getting no provode error whileconnectiong to INBOX. Please find 
the 
E> > rror Message and samle code 

> > Thnaks 

> > Regards

> > SRK

> > Error Message
-> > -----------

> > Exception in thread "main" javax.mail.NoSuchProviderException: No 
p> rovider 
f> > or pop3
 > >        at javax.mail.Session.getProvider(Session.java:249)
 > >        at javax.mail.Session.getStore(Session.java:323)
 > >        at javax.mail.Session.getStore(Session.java:303)
 > >        at Mail.main(Mail.java:13)

> > 
S> > ample code
-> > ----------

> > 
i> > mport javax.mail.*;
i> > mport javax.mail.internet.*;

> > public class Mail
{> > 
p> > ublic static void main (String args[]) throws Exception
 > >    {
	> > Session session = Session.getInstance(System.getProperties(), 
n> > ull);

> > 	Store store = null;
	> > store = session.getStore("pop3");

> > 	store.connect("pop3.freeserve.net", "xxx@f...", "xxx");

> > 
	> > Folder folder = store.getFolder("INBOX");
	> > folder.open(Folder.READ_ONLY);

> > 	int count = folder.getMessageCount();

> > 	System.out.println("Messages waiting: "  + count);

> > 	count = folder.getUnreadMessageCount();

> > 	System.out.println("Unread messages waiting: "  + count);

> > 	folder.close(false);
	> > store.close();

> >   }

  Return to Index