Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Receiving mails from mail sever using IMAP getting problem in jboss-4.0.5.G

843834Apr 26 2010 — edited Apr 27 2010
Hi,

I am trying to get mails from mail server using IMAP.I have run below code as standalone application.It worked well and i got mails.However, when I was trying to use below code in web application I was getting problem.I am using the same jars( which used for standalone application )in webapplication.

Here is my code......

java.security.Security.setProperty("ssl.SocketFactory.provider", "DummySSLSocketFactory");
System.setProperty("javax.net.ssl.trustStore","JAVA_HOME/jre/lib/security/cacert");
// System.setProperty("javax.net.ssl.keyStore","key store path");
System. setProperty("javax.net.ssl.keyStorePassword" , "changeit" );
System. setProperty("javax.net.ssl.trustStorePassword" , "changeit" );
/* Create the session and get the store for read the mail. */
Session session = Session.getDefaultInstance(props, null);
Store store =session.getStore("imaps");
store.connect("host","username","pwd"); *// Exception here*
System.out.println("connected ");

Exception is

javax.mail.MessagingException: Unconnected sockets not implemented;
nested exception is:
java.net.SocketException: Unconnected sockets not implemented
14:06:05,186 ERROR [STDERR] at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:611)
14:06:05,186 ERROR [STDERR] at javax.mail.Service.connect(Service.java:291)
14:06:05,186 ERROR [STDERR] at javax.mail.Service.connect(Service.java:172)
14:06:05,186 ERROR [STDERR] at com.maxis.mail.IMAPMailReader.getMails(IMAPMailReader.java:59)
14:06:05,186 ERROR [STDERR] at org.apache.jsp.jsp.mailMgmt_jsp._jspService(mailMgmt_jsp.java:66)
14:06:05,192 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
14:06:05,192 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

I am using linux os,jboss-4.0.5.GA application server and jdk1.5.0_05.

I could not understand Where went wrong.

Could someone help me,please?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 25 2010
Added on Apr 26 2010
2 comments
153 views