Javax.mail.Session

I am trying to write a program to send email. I have problem when I tried to compile my prog. They are something like these:
Method getInstance(java.util.Properties)
not found in class Session.
Session session = Session.getInstance(props);
^
Incompatible type for constructor. Can't convert Session to javax.mail.internet.MimeMessage.
Message message = new MimeMessage(session);
^
2 errors
Anyone can help me get around these things.

Its probably getting confused between javamail session and standard session
Try using javax.mail.Session instead of session.
javax.mail.Session session = javax.mail.Session.getInstance(props);

Similar Messages

  • Always get the InternetAddress & javax.mail.Session error

    <%@ page import="javax.mail.*" %>
    <%@ page import="javax.mail.internet.*" %>
    <%@ page import="javax.activation.*" %>
    <%@ page import="java.util.*,java.io.*" %>
    <%@ page contentType="text/html;charset=big5" %>
    <html>
    <head>
    <title>JavaMail</title>
    </head>
    <body>
    <h2>&#21033;&#29992;JavaMail&#20358;&#20659;&#36865;&#38651;&#23376;&#37109;&#20214; - &#38468;&#21152;&#27284;&#26696;</h2>
    <%
    InternetAddress[] address = null;
    request.setCharacterEncoding("big5");
    // MultipartRequest multi = new MultipartRequest(request , "." , 5*1024*1024 , "big5");
    String mailserver = "mail.dwu.edu.tw";
    String From = request.getParameter("From");
    String to = request.getParameter("To");
    String Subject = request.getParameter("Subject");
    String type = request.getParameter("Type");
    String messageText = request.getParameter("Message");
    String FileName = request.getParameter("FileName");
    boolean sessionDebug = false;
    try {
    // &#35373;&#23450;&#25152;&#35201;&#29992;&#30340;Mail &#20282;&#26381;&#22120;&#21644;&#25152;&#20351;&#29992;&#30340;&#20659;&#36865;&#21332;&#23450;
    java.util.Properties props = System.getProperties();
    props.put("mail.host",mailserver);
    props.put("mail.transport.protocol","smtp");
    // &#29986;&#29983;&#26032;&#30340;Session &#26381;&#21209;
    javax.mail.Session mailSession = javax.mail.Session.getDefaultInstance(props,null);
    mailSession.setDebug(sessionDebug);
    Message msg = new MimeMessage(mailSession);
    // &#35373;&#23450;&#20659;&#36865;&#37109;&#20214;&#30340;&#30332;&#20449;&#20154;
    msg.setFrom(new InternetAddress(From));
    // &#35373;&#23450;&#20659;&#36865;&#37109;&#20214;&#33267;&#25910;&#20449;&#20154;&#30340;&#20449;&#31665;
    address = InternetAddress.parse(to,false);
    msg.setRecipients(Message.RecipientType.TO, address);
    // &#35373;&#23450;&#20449;&#20013;&#30340;&#20027;&#38988;
    msg.setSubject(Subject);
    // &#35373;&#23450;&#36865;&#20449;&#30340;&#26178;&#38291;
    msg.setSentDate(new Date());
    if (FileName != null)
    File file = new File(FileName);
    // &#22914;&#26524;&#26377;&#38468;&#21152;&#27284;&#26696;&#26178;&#65292;&#20808;&#23559;&#37109;&#20214;&#20839;&#23481;&#37096;&#20221;&#20808;&#23384;&#36215;&#20358;
    MimeBodyPart mbp1 = new MimeBodyPart();
    // &#35373;&#23450;&#37109;&#20214;&#20839;&#23481;&#30340;&#22411;&#24907;&#28858; text/plain &#25110; text/html
    mbp1.setContent(messageText, type + ";charset=big5");
    // &#20877;&#20358;&#23565;&#27284;&#26696;&#20316;&#34389;&#29702;
    MimeBodyPart mbp2 = new MimeBodyPart();
    FileDataSource fds = new FileDataSource(FileName);
    mbp2.setDataHandler(new DataHandler(fds));
    mbp2.setFileName(MimeUtility.encodeText(fds.getName(), "big5", "B"));
    // &#26368;&#24460;&#20877;&#23559;&#20108;&#32773;&#25972;&#21512;&#36215;&#20358;&#65292;&#30070;&#20316;&#19968;&#20221;&#37109;&#20214;&#36865;&#20986;
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    mp.addBodyPart(mbp2);
    msg.setContent(mp);
    else
    // &#33509;&#27794;&#26377;&#27284;&#26696;&#26178;&#65292;&#23601;&#30452;&#25509;&#23384;&#37109;&#20214;&#20839;&#23481;
    msg.setContent(messageText,type + ";charset=big5");
    Transport.send(msg);
    out.println("&#37109;&#20214;&#24049;&#38918;&#21033;&#20659;&#36865;");
    catch (MessagingException mex)
    mex.printStackTrace();
    %>
    </body>
    </html>
    ==================================
    i don't know why i always get the error about the type even i already add the jar file in lib folder:
    InternetAddress cannot be resolved to a type
    javax.mail.Session cannot be resolved to a type

    What server are you using?
    Did you follow the instructions on the JavaMail FAQ for setting up the server?
    Did you restart the server?

  • Authorization error for referenced class javax/mail/Session.

    All,
    I am trying to compile a java source which is using session object in javax/mail/session.
    I am getting the error java/lang/System: Authorization error for referenced class javax/mail/Session.
    I used "import javax.mail.*;" in my java source..
    I loaded both mail.jar and activation.jar using the below command in different schema other than the schema which above java source exists.
    loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym activation.jar
    loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym mail.jar
    After loading, All java classes in mail.jar and activation.jar were in compiled state in that schema
    Its working well in different database having the same configuration.
    My oracle version is Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production

    I have to accomplish tried in CONSOLE TestMail.class:
    C>java TestMail
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Partmy make.bat:
    javac -g -classpath
    ...\Java\jre1.5.0_06\lib\activation.jar;...\jre1.5.0_06\lib\imap.jar;...\jre1.5.0_06\lib\mail.jar;...\jre1.5.0_06\lib\mailapi.jar;...\jre1.5.0_0\lib\plugin.jar;...\jre1.5.0_06\lib\pop3.jar;...\jre1.5.0_06\lib\smtp.jar;...\jre1.5.0_06\lib\javamail-1_3_2-src-jrl.zip;...\jre1.5.0_06\lib\j2ee.jar  TestMail.javaWhat isn't correct?
    Tanks,
    Mohammad

  • Javax.mail.Session Class Cast Exception

    I'm tryin' to send a mail via JNDI Java Mail Session, but when i get the look up Object, ClassCastException are thrown
    When i take the o.getClass().getName() is equal to the cast class that i use. I don't know what to do.
    Source --->
    Object o;
    context = new InitialContext();
    o = context.lookup("java:comp/env/mail/mysession");
    System.out.println(o.getClass().getName());
    return (javax.mail.Session) o; // Exception here!

    DUH!
    I'm using incorrect mail.jar version...
    :')

  • Change the Mail-Session's type in glassfish to type javax.mail.Session

    hi all guys!
    com.sun.enterprise.deployment.MailConfiguration is the default type of Mail_Session in the glassfish, but I want the javax.mail.Session to construct a MimeMessage!
    How can I do?
    All comments will be appriciate!

    It sounds like you are attempting to lookup the resource using the non-portable server dependent resource name (and you are getting a non-portable server dependent result in return).
    If instead, you use the portable JNDI name of the mail resource, the expected javax.mail.Session object will be returned, e.g.
    Session mailSession = (Session) ic= new InitialContext().lookup("java:comp/env/mail/mobileMailSession");
    Also make sure that the resource has been assigned the JNDI name you decide on ("mail/mobileMailSession" in the example above).
    See also https://glassfish.dev.java.net/issues/show_bug.cgi?id=4500 and http://forum.java.sun.com/thread.jspa?threadID=5277688&tstart=75 for more information and context.

  • Unable to lookup javax.mail.Session in JNDI lookup

    Hi,
    We are getting java.io.NotSerializable exception when trying to lookup javax.mail.Session
    in JNDI lookup.
    The code is as follows:
    try {
    Hashtable ht = new Hashtable();
    ht.put(Context.PROVIDER_URL, "t3://localhost:localport");
    ht.put (Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    Context ctx = new InitialContext(ht);
    try {
    Object obj = ctx.lookup("jndiname_of_Mailsession");
    session = (Session)javax.rmi.PortableRemoteObject.narrow(obj, Session.class);
    } catch (Exception ex1) {
    ex1.printStackTrace();
    The exception stacktrace is as follows:
    javax.naming.ConfigurationException. Root exception is java.rmi.MarshalException:
    error marshalling return; nested exception is:
         java.io.NotSerializableException: javax.mail.Session
    java.io.NotSerializableException: javax.mail.Session
    We are using Weblogic 6.0 SP2.
    Any clue will be helpful to us.
    Thanks.

    Hello Sumit
    You've got this exception because javax.mail.Session is not serializable. It
    does not depend on whatever implementation you use. In fact you can only use
    the mail session you set up when you are in the server. I mean, when you try
    to use it from an EJB, http bean session or whatever code that runs in the
    weblogic server. Weblogic does not give a Serialized copy of the session to
    the client but directly a reference on the only one Session created at boot
    time, even if you lookup for it.
    In your exemple, you try to get a reference on a Session from a client
    program. It cannot work ! Session is not Serializable.
    Hope this help
    dom
    "Sumit " <[email protected]> a écrit dans le message news:
    3b3ac101$[email protected]..
    >
    Hi,
    We are getting java.io.NotSerializable exception when trying to lookupjavax.mail.Session
    in JNDI lookup.
    The code is as follows:
    try {
    Hashtable ht = new Hashtable();
    ht.put(Context.PROVIDER_URL, "t3://localhost:localport");
    ht.put (Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    Context ctx = new InitialContext(ht);
    try {
    Object obj = ctx.lookup("jndiname_of_Mailsession");
    session = (Session)javax.rmi.PortableRemoteObject.narrow(obj,Session.class);
    } catch (Exception ex1) {
    ex1.printStackTrace();
    The exception stacktrace is as follows:
    javax.naming.ConfigurationException. Root exception isjava.rmi.MarshalException:
    error marshalling return; nested exception is:
    java.io.NotSerializableException: javax.mail.Session
    java.io.NotSerializableException: javax.mail.Session
    We are using Weblogic 6.0 SP2.
    Any clue will be helpful to us.
    Thanks.

  • Exception in thread "main" javax.mail.NoSuchProviderException: invalid prov

    HI,
    I am trying to read mails from my inbox i amgetting the ErrorC:\javamail>java
    Readmail
    Exception in thread "main" javax.mail.NoSuchProviderException: No provider for IMAP
            at javax.mail.Session.getProvider(Session.java:455)
            at javax.mail.Session.getStore(Session.java:530)
            at javax.mail.Session.getStore(Session.java:510)
            at Readmail.main(Readmail.java:24)My Code is    {
    String host = "hostname";
    String username = "user";
    String password = "password";
    // Create empty properties
    Properties props = new Properties();
    // Get session
    Session session = Session.getDefaultInstance(props,null);
    // Get the store
    Store store = session.getStore("IMAP");
    store.connect(host, username, password);
    // Get folder
    Folder folder = store.getFolder("Inbox");
    folder.open(Folder.READ_ONLY);
    // Get directory
    Message message[] = folder.getMessages();
    for (int i=0, n=message.length; i<n; i++)
       System.out.println(i + ": " + message.getFrom()[0]
    + "\t" + message[i].getSubject());
    // Close connection
    folder.close(false);
    store.close();
    I have also tried POP3 and MIME and SMTP
    Can anyone help me Thanks

    hi bshannon,
    I am getting the same error for others but for pop3 the error is as below
    Exception in thread "main" javax.mail.MessagingException: Connect failed;
      nested exception is:
            java.net.ConnectException: Connection refused: connect
            at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:148)
            at javax.mail.Service.connect(Service.java:275)
            at javax.mail.Service.connect(Service.java:156)
            at Readmail.main(Readmail.java:25)
    Caused by: java.net.ConnectException: Connection refused: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
            at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
            at java.net.Socket.connect(Socket.java:452)
            at java.net.Socket.connect(Socket.java:402)
            at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
            at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
            at com.sun.mail.pop3.Protocol.<init>(Protocol.java:81)
            at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:201)
            at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:144)
            ... 3 more

  • Import statement not found for javax.mail.Message

    when i'm in webSphere shich is using jdk1.4.2,
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Session;
    import javax.mail.internet.AddressException;
    import javax.mail.internet.InternetAddress;
    cannot be found
    Where would the Mail classes be located?
    Thank you

    mail.jar and activation.jar, which can be downloaded here:
    http://java.sun.com/products/javamail/downloads/index.html
    http://java.sun.com/products/javabeans/jaf/downloads/index.html

  • Best practice for keeping a mail session open in web application?

    Hello,
    We have a webmail like application where users login with their IMAP credentials, then are taken to an authenticated area of the site where they can manage different things about their email account.
    Right now the application is opening and closing a mail store connection (via a new javax.mail.Session) for each page load based on the current logged in user credentials. To me this seems like it would be a bad practice to keep opening and closing a connection each page load.
    Are there any best practices for this situation? It would be nice to be able to open the connection to the mail server on login, then keep that connection open until the person logs out, session expires, etc.
    I can probably put the javax.mail.Session into the HTTP session, but that seems like it would break any clustering functionality of tomcat. This would be fine if the machine the user is on didn't fail, but id assume if they failed over to another the mail session would be gone. Maybe keeping the mail session in the http session, checking for a connection, then first attempting to reconnect with the logged in credentials before giving up would be a possiblity?
    Any pointers would be appreciated

    If you keep the connection open across pages, you're going to need to deal with
    timeouts - from the http session and from the mail server.
    If you don't keep the connection open, you're going to need to "resynchronize"
    your view of the store/folder with each operation, in case the folder is modified
    by another session.
    The former is easier in the common cases, especially if you don't care how gracefully
    you handle failures. The latter is more difficult in the common cases, but handles
    failure better, and in particular handles clustering better. You'll need to measure it to
    see if it meets your performance and scalability requirements. You may need to mix
    the two approaches to get acceptable performance.

  • Error Compiling With java.mail.Session class

    Hi,
    The Java compiler issues an error message (below) during compilation of the following line:
    Session session = Session.getDefaultInstance( fMailServerConfig, null );
    The error message is:
    bad class file: c:\j2ee_sdk\lib\j2ee.jar(javax/mail/Session.class)
    class file has wrong version 48.0, should be 47.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    javax.mail.Session session = javax.mail.Session.getDefaultInstance( fMailServerConfig, null );
    I have tried switching between JDKs by changing the JAVA_HOME environment variable between JDKs 1.3.x to 1.4.x to 1.5.x and also to the JDK installed with the 2005 Q1 J2EE installation that I am using.
    Any ideas on how to resolve this problem? And help would be GREATLY appreciated.
    Thanks!!!
    Stuart Hoffman

    in Session session = Session.getDefaultInstance( fMailServerConfig, null ); pass the object of properties class instead of mailServerconfig
    now your problem are solved

  • Javax.mail.NoSuchProviderException: No provider for ifs1

    Similar to the question found in William Troper's thread run on
    November 1. We had mail code working fine, changed some
    variables to incorporate a migratable build and have now lost
    our mail functionality.
    We have followed William's advice by renaming all of Sun's Mail
    classes in the ~\9ifs\settings\META-INF directory and still no
    joy.
    Does anyone have any ideas of what is causing a "No provider for
    ifs1" error message?
    Cheers,
    Susan

    Hi Scott,
    These (among other) items are in my CLASSPATH (printed out at
    runtime)
    /projects/intranet/lib/mail.jar:/app/oracle/product/9.0.1S/9ifs/s
    ettings/META-INF:
    Here is my stack. Also, the code is EXACLTY the same between
    what was working and what is now not. Thanks for looking in to
    this:
    javax.mail.NoSuchProviderException: No provider for ifs1
         at javax.mail.Session.getProvider(Session.java:249)
         at javax.mail.Session.getTransport(Session.java:442)
         at javax.mail.Session.getTransport(Session.java:423)
         at com.mim.intranet.utils.MessageFactory.sendMesg
    (MessageFactory.java:130)
         at
    com.mim.intranet.unittest.utils.MessagingUT.testValidMesg
    (MessagingUT.java:56)
         at java.lang.reflect.Method.invoke(Native Method)
         at junit.framework.TestCase.runTest(TestCase.java:166)
         at junit.framework.TestCase.runBare(TestCase.java:140)
         at junit.framework.TestResult$1.protect
    (TestResult.java:106)
         at junit.framework.TestResult.runProtected
    (TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:131)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at junit.textui.TestRunner.doRun(TestRunner.java:74)
         at junit.textui.TestRunner.run(TestRunner.java:200)
         at com.mim.intranet.unittest.AllTests.main
    (AllTests.java:40)
    4887 [main] WARN com.mim.intranet.unittest.utils.MessagingUT -
    Sending Exception
    F
    Time: 4.898
    There was 1 failure:
    1) testValidMesg(com.mim.intranet.unittest.utils.MessagingUT)
    junit.framework.AssertionFailedError: Failed sending message :
    com.mim.intranet.exception.IntranetException: Failed sending
    message encountered unexpected exception
    Wrapped Exception is : javax.mail.NoSuchProviderException: No
    provider for ifs1
         at
    com.mim.intranet.unittest.utils.MessagingUT.testValidMesg
    (MessagingUT.java:63)
         at com.mim.intranet.unittest.AllTests.main
    (AllTests.java:40)
    FAILURES!!!
    Tests run: 1, Failures: 1, Errors: 0
    com.mim.intranet.exception.IntranetException: Failed sending
    message encountered unexpected exception
    Wrapped Exception is : javax.mail.NoSuchProviderException: No
    provider for ifs1
         at com.mim.intranet.utils.MessageFactory.sendMesg
    (MessageFactory.java:187)
         at
    com.mim.intranet.unittest.utils.MessagingUT.testValidMesg
    (MessagingUT.java:56)
         at java.lang.reflect.Method.invoke(Native Method)
         at junit.framework.TestCase.runTest(TestCase.java:166)
         at junit.framework.TestCase.runBare(TestCase.java:140)
         at junit.framework.TestResult$1.protect
    (TestResult.java:106)
         at junit.framework.TestResult.runProtected
    (TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:131)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at junit.framework.TestSuite.runTest(TestSuite.java:173)
         at junit.framework.TestSuite.run(TestSuite.java:168)
         at junit.textui.TestRunner.doRun(TestRunner.java:74)
         at junit.textui.TestRunner.run(TestRunner.java:200)
         at com.mim.intranet.unittest.AllTests.main
    (AllTests.java:40)
    -----------------------------------------------------------------

  • Javax.mail.*; not being seen by portal in EP 6

    Hello All,
    It seems that when I deploy the following code:
    package com.giggity;
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.AddressException;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    import com.sapportals.portal.prt.component.AbstractPortalComponent;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    public class Mailer extends AbstractPortalComponent
      public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
      Properties p = System.getProperties();
      p.put("mail.host", "stmail");
      try{
      MimeMessage message =
    new MimeMessage(Session.getInstance(p, null));
    message.setFrom(new InternetAddress("[email protected]"));               message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]"));
    message.setSubject("No work");
    message.setText("Does not work");
    Transport.send(message);
    catch(Exception e)
    I get a javax/mail/Address ClassNotFoundException.  In
    the IDE (Eclipse with PDK plugin, not using NW04), it
    compiles and builds just fine.  What is the problem?
    Thanks.
    -Greg

    Successful compilation or building in the eclipse/NWDS does not mean that it can be successfully deployed on the portal. If the Java build path has all the required jars, any project compiles and builts fine but that build path is not transported to the portal( see inside any par file, there won't be any .classpath and .project files. They are local only files).
    ========
       Add all your third party jar files to the component in this path( ..\dist\PORTAL-INF\lib). There is no need to add mail.jar as it's already available in sap j2ee engine. So add these lines to the portalapp.xml. (as told by jagdeep)
    <application-config>
    <property name="PrivateSharingReference" value="SAPJ2EE::library:mail"/>
    </application-config>
    Regs,
    Bobby

  • Import javax.mail not found problem

    I have downloaded the most recent mail.jar and activation.jar files and have created a library w/in JDev called javamail and have added these jars to that library. I have also included this library in my ViewController Project. The problem I am having is that the following imports statements are not found by JDev:
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMultipart;
    When I open up the mail.jar I can find all of these classes, so why are these imports not being recongnized?
    I have also tried import javax.mail.*; to include everthing and this does not work either.
    Does anyone have any suggestions on how to trouble shoot this issue?

    Try to add the J2EE library - which is predefined in JDeveloper- to your project's libraries.
    Worked for me.

  • Javax.mail jar compilation error

    Dear friends,
    I have created a DC which manages emails to users which uses the following import statements
    import javax.mail.Message;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    i downloaded the javax.mail package which was supposed to contain the needed jars and added it to the DC ( preferences->add ext libraries->)
    But i still find errors in the code.......
    Did i import the right package or should the jars be added in another way??
    Thanks and regards
    SantoshKumar

    Thanks for your response Levy, can u please help me in which folder under /eclipse/plugins does that jar file exist and by what name?
    We are using JDK 1.4.2_16 and NWDS 7.0.0 and the portal server is on 1.4.2_12 and  EP7.0 SP15 does this cause problem because we are facing a classversion error on deployment. What version of JDK is preferable to our environment??
    Thanks and regards
    SantoshKumar A

  • Gmail mail-session

    Hi,
    I hope that someone can help me.
    I'm trying to send an email from a jsp file with oc4j 10.1.2 and 10.1.3 and i receive the same error.
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
         class javax.mail.AuthenticationFailedException
         at javax.mail.Transport.send0(Transport.java:218)
         at javax.mail.Transport.send(Transport.java:80)
         at untitled1.jspService(_untitled1.java:79)
         [untitled1.jsp]
         at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.3.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
         at java.lang.Thread.run(Thread.java:595)
    I configure the <mail-session> like this.
    <mail-session location="mail/GmailSmtpServer" smtp-host="smtp.gmail.com">
    <property name="mail.smtp.port" value="465"/>
    <property name="mail.smtp.auth" value="true"/>
    <property name="mail.smtp.user" value="[email protected]"/>
    <property name="password" value="xxxxxxxx"/>
    <property name="mail.smtp.starttls.enable" value="true"/>
    <property name="mail.smtp.socketFactory" value="javax.net.ssl.SSLSocketFactory"/>
    </mail-session>
    If i try with tomcat with the same configuration and it works perfect.
    <Resource name="mail/GmailSmtpServer"
    auth="Container"
    type="javax.mail.Session"
    mail.smtp.host="smtp.gmail.com"
    mail.smtp.port="465"
    mail.smtp.auth="true"
    mail.smtp.user="[email protected]"
    password="xxxxxxx"
    mail.smtp.starttls.enable="true"
    mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
    />
    Thank You.
    JP

    I had an error with
    <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLServerSocketFactory"/>
    because i put mal.smtp.socketFactory without the .class
    Now i receive a different error
    java.io.IOException: Couldn't connect using "javax.net.ssl.SSLServerSocketFactory" socket factory to host, port: smtp.gmail.com, -1; Exception: java.lang.NoSuchMethodException: javax.net.ssl.SSLServerSocketFactory.createSocket(java.lang.String, int)
    I attached the jsse.jar, but it didn't resolve the problem.
    Thanks.
    JP

Maybe you are looking for

  • Wrong values for miro

    Hi, I am creating a PO through me21n.(Trader Scenario) where no excise value is calculated  and Vat 4% for condition type JVRD is added to the base value and addtional tax of 1% with condition type JVCA is added to the base value. When GR is created

  • Portal Activity Report - Aggregator System Load

    Hey Everyone, What is everyone's impression of the Portal Activity Report? Is it helpful? Do we really have anyother options to get valid reports on usuage? Also, what type of load does the Aggregator really put on its server? Thanks

  • Struts Interview questions

    Send Struts interview question in my mail id [email protected]

  • Are Apple Mad!!! They sell DVD writers but you can't burn DVD's on them

    You buy yourself an imac they sell you a dvd burner you do an imovie presentation for your daughters christmas present about a trip to Harry Potter Studio Tour, to you find apple in its wisdom no longer produces iDVD software they even still have a D

  • Obtaining unique records

    I am trying to build a query using two tables. One is a table called sanctuary lakes cleaning data. The other one is called Faulire data. In cleaining table there are four years of cleaning records for each pit. I want to find the performance of thes