Error: SHA1 digest error for javax/mail/Authenticator.class

I am using javax.mail api to sending emails.
when I calls main method of the class to send email its works perfect, but when I imports the same class in jsp its shows me above said error.
My email server requires authentication before sending mails.
please guide me how to use this class in jsp .
class code is as below :
=========================
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
public class SendMailUsingAuthentication
private static final String SMTP_HOST_NAME = "myserver.smtphost.com";
private static final String SMTP_AUTH_USER = "myusername";
private static final String SMTP_AUTH_PWD = "mypwd";
private static final String emailMsgTxt = "Online Order Confirmation Message. Also include the Tracking Number.";
private static final String emailSubjectTxt = "Order Confirmation Subject";
private static final String emailFromAddress = "[email protected]";
// Add List of Email address to who email needs to be sent to
private static final String[] emailList = {"[email protected]", "[email protected]"};
public static void main(String args[]) throws Exception
SendMailUsingAuthentication smtpMailSender = new SendMailUsingAuthentication();
smtpMailSender.postMail( emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);
System.out.println("Sucessfully Sent mail to All Users");
public void postMail( String recipients[ ], String subject,
String message , String from) throws MessagingException
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
addressTo[i] = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
* SimpleAuthenticator is used to do simple authentication
* when the SMTP server requires it.
private class SMTPAuthenticator extends javax.mail.Authenticator
public PasswordAuthentication getPasswordAuthentication()
String username = SMTP_AUTH_USER;
String password = SMTP_AUTH_PWD;
return new PasswordAuthentication(username, password);

Find all the jar files under Tomcat's installation directory and all the jar files in the jre/lib/ext directory.
Make sure only one of them includes javax.mail.* classes.
Note that setting CLASSPATH to a directory does not cause all jar files in that directory to be loaded.
Finally, make sure Eclipse isn't copying the class files out of mail.jar and packaging them with your
application.

Similar Messages

  • SHA1 digest error for javax/mail/Message.class

    it's been 4 hrs that i am striving to get around this .....Does any body has any idea why this error appears and how to remedy it ....
    help will be much much appreciated....

    Either:
    1. Your mail.jar is corrupted, or
    2. You have more than one copy of the javax.mail.Message class in your CLASSPATH.

  • SHA1 digest error for javax/mail/MessagingException

    java.lang.SecurityException: SHA1 digest error for javax/mail/MessagingException.class
         at sun.security.util.ManifestEntryVerifier.verify(ManifestEntryVerifier.java:194)
         at java.util.jar.JarVerifier.processEntry(JarVerifier.java:201)
         at java.util.jar.JarVerifier.update(JarVerifier.java:188)
         at java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:411)
         at sun.misc.Resource.getBytes(Resource.java:97)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:256)
         at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    Exception in thread "main"
    What could be the problem for this error Exception ???
    Thanks and Regards.

    Hi!
    Do you use some plugins with eclipse IDE, like Tomcat by example or other plugins ... ?
    If yes, update mail.jar and activation.jar inside Tomcat or in your lib project Eclipse...
    You have a conflict with the class loader that check for security for class javax/mail/MessagingException
    See you Manifest.mf inside mail.jar :
    (old version here...)
    Manifest-Version: 1.0
    Implementation-Version: 1.4
    Specification-Title: JavaMail(TM) API Design Specification
    Specification-Version: 1.3
    Implementation-Title: javax.mail
    Extension-Name: javax.mail
    Created-By: 1.5.0 (Sun Microsystems Inc.)
    Implementation-Vendor-Id: com.sun
    Implementation-Vendor: Sun Microsystems, Inc.
    Specification-Vendor: Sun Microsystems, Inc.
    SCCS-ID: @(#)javamail.mf     1.6 05/12/09
    Name: javax/mail/search/SearchTerm.class
    SHA1-Digest: SwGnDhIUmpZhfhq/FKkCQ9nD7ZE=
    Name: javax/mail/SendFailedException.class
    SHA1-Digest: XdCEygaIZQB9YrH2WIr4nPRYYk0=
    Name: javax/mail/MessagingException.class
    SHA1-Digest: lfjX30OQ88v/n9G9fTJGqjFmPd0=
    regards,

  • Error in using flags for retrieving mail folders

    Hi i tried with the blow clde for retrieving the folders of the mail . i am getting the error . i.e
    Javax.mail.MessagingException:connection timed out
    the code is;
    import java.util.Properties;
    import javax.mail.Authenticator;
    import javax.mail.Flags;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.URLName;
    import javax.mail.internet.InternetAddress;
    public class MainClass {
    public static void main(String[] args) throws Exception {
    URLName server = new URLName("protocol://username@host/foldername");
    Session session = Session.getDefaultInstance(new Properties(), new MailAuthenticator());
    Folder folder = session.getFolder(server);
    if (folder == null) {
    System.out.println("Folder " + server.getFile() + " not found.");
    System.exit(1);
    folder.open(Folder.READ_ONLY);
    // Get the messages from the server
    Message[] messages = folder.getMessages();
    for (int i = 0; i < messages.length; i++) {
    // Get the headers
    System.out.println("From: " + InternetAddress.toString(messages.getFrom()));
    System.out.println("Reply-to: " + InternetAddress.toString(messages[i].getReplyTo()));
    System.out.println("To: " + InternetAddress.toString(messages[i].getRecipients(Message.RecipientType.TO)));
    System.out.println("Cc: " + InternetAddress.toString(messages[i].getRecipients(Message.RecipientType.CC)));
    System.out.println("Bcc: " + InternetAddress.toString(messages[i].getRecipients(Message.RecipientType.BCC)));
    System.out.println("Subject: " + messages[i].getSubject());
    System.out.println("Sent: " + messages[i].getSentDate());
    System.out.println("Received: " + messages[i].getReceivedDate());
    if (messages[i].isSet(Flags.Flag.DELETED)) {
    System.out.println("Deleted");
    if (messages[i].isSet(Flags.Flag.ANSWERED)) {
    System.out.println("Answered");
    if (messages[i].isSet(Flags.Flag.DRAFT)) {
    System.out.println("Draft");
    if (messages[i].isSet(Flags.Flag.FLAGGED)) {
    System.out.println("Marked");
    if (messages[i].isSet(Flags.Flag.RECENT)) {
    System.out.println("Recent");
    if (messages[i].isSet(Flags.Flag.SEEN)) {
    System.out.println("Read");
    if (messages[i].isSet(Flags.Flag.USER)) {
    // We don't know what the user flags might be in advance
    // so they're returned as an array of strings
    String[] userFlags = messages[i].getFlags().getUserFlags();
    for (int j = 0; j < userFlags.length; j++) {
    System.out.println("User flag: " + userFlags[j]);
    folder.close(false);
    class MailAuthenticator extends Authenticator {
    public MailAuthenticator() {
    public PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication("username", "password");
    Any one can help me.

    Ok thankyou. i will do it from next time. Please give me code changes for my problem.

  • Java.lang.SecurityException: SHA1 digest error

    Hi,
    I am trying to use pack200 on the signed jar file and it fails.
    I use the following steps:
    1. pack200 --repack --segment-limit=-1 --strip-debug test.jar
    2. jarsiner ... (long command to sign my JAR file)
    3. pack200 test.jar.pack.gz test.jarI have both files on the server and JNLPDownloadServlet finds compressed file and sends to to the client.
    The client can not validate signature
    com.sun.deploy.net.JARSigningException: Could not verify signing in resource:
    Wrapped exception is:
    java.lang.SecurityException: SHA1 digest error fo
    There is Bug opened: [5078608|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5078608] but the workaround does not in 1.6.0.16 or 1.6.0.18.
    Any advice?

    Hi,
    same problem with java 1.6 on Windows XP
    "java.lang.SecurityException: SHA1 digest error for ..."
    Sometimes when I re-build and sign my jar using "jarsigner -verifier" to verify, it is not correctly deployed with java web start because one resource SHA1 digest has got an error.
    May be size of some binary resources in it (>20M) can have an effect ...
    Does anybody have an idea ?

  • Cannot find the classfile for javax.mail.internet.AddressException

    Hi,
    Scenario is SAPCRM 7.0/ECC.
    We are trying to extend the EmailAction class.
    The error bieng faced is
    Cannot find the classfile for javax.mail.internet.AddressException.
    We have added crm/isa/lwc to the used Dcs but still this error is there.
    Mail.jar is also present in the system.
    We are not able to make out what exactly the issue is.
    Please help.
    Thanks,
    Rohit

    Hi Rohit,
    Did you ever find the solution to this problem?  We're encountering the same error message.
    Thanks!
    Joe

  • Failed to  load javax.mail.Address class

    Hi,
    We are using NAS 4.0 sp 6 on solaris 8. I have noticed
    time and again on restarting NAS, the kjs engine is not able to load the javax.mail.Address class. This happens not every time but every now and then. What
    could be the reason for this ?
    Thanks for any help,
    Amit

    Has anybody an idea about this issue?

  • Problem with recognizing javax.mail.* class ?

    Hi Folks,
    I am new to JavaMail usage on a standalone java program. I did write a java program to send a mail. The problem is it is not recognizing the javax.mail.* class, though i added on the classpath. I too added mail.jar file in the c:\program files\java\jdk1.5.0_16\lib and added the reference same to the classpath and still it is not recognizing. Do i miss something? help me out guys.
    Regards,
    jaisuryah

    Hi Shannon,
    I hope the configuration i did is well. Yah am running the Java from the command line and i dont know why importing the package of javax.mail.* classes are not recognizing. I did unzipped the zip file and placed all the JAR files to lib folder of my installed JDK and referenced the JDK to classpath in environment variable also.
    Regards,
    Jaisuryah

  • Outgoing SMTP for Mac Mail Authentication (none or password)?

    i have had to set up a test account due to some corruption issues and i have a new temporary password for iCloud.
    and i am in the outgoing SMTP > ADVANCED section of mail.
    does anyone know if i set up a SMTP server for Mac Mail as having an authentication set to "none" or set to "password" and whether this password should be my new temp pass?

    If your ISP requires POP before SMTP authentication which requires checking the account's incoming mail server for new mail before being able to send with the account's SMTP server (checking the account for new mail should be required once per session only), then authentication for the SMTP server should be set to None.
    Go to Mail > Preferences > Accounts and under the account information tab for the account preferences at the SMTP server selection, select the Server Setting button below.
    If Password is selected for SMTP authentication, change it to None and test if this resolves the problem.
    If None is selected and your ISP requires password authentication for their SMTP server, select Password and enter the account's user name and password required for the authentication.

  • 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

  • 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...
    :')

  • Error while configuring  Webgate for simple mode authentication

    Trying to convert open mode authentication to simple mode. Followed the documentation.
    http://download.oracle.com/docs/cd/E12530_01/oam.1014/b32419/trnscrty.htm#BGBGEIFB
    Was able to get identity server and access server configured. As in...got no error. When trying to change to simple mode for Webgate getting the following error....
    Client authentication failed, please verify your WebGate ID.
    Command executed for one of the webgates is below....Any thoughts??
    ./start_configureWebGate -i /u01/app/oracle/product/10.1.4.2.2/OAM/webgate/access -t WebGate -R
    Please enter the Mode in which you want the Web Gate to run : 1(Open) 2(Simple) 3(Cert) : 2
    Please enter the Password for this Web Gate :
    Please note that the Global Access Protocol Pass phrase has to be the same across all Access Servers and Web Gates installed in Simple mode
    Please enter the Global Access Protocol Pass phrase :
    Preparing to generate certificate. This may take up to 60 seconds. Please wait.
    Generating a 1024 bit RSA private key
    ........................++++++
    .......................................++++++
    writing new private key to '/u01/app/oracle/product/10.1.4.2.2/OAM/webgate/access/oblix/config/simple/aaa_key.pem'
    writing RSA key
    Using configuration from /u01/app/oracle/product/10.1.4.2.2/OAM/webgate/access/oblix/tools/openssl/openssl_silent.cnf
    DEBUG[load_index]: unique_subject = "yes"
    Check that the request matches the signature
    Signature ok
    The Subject's Distinguished Name is as follows
    countryName :PRINTABLE:'US'
    stateOrProvinceName :PRINTABLE:'Some-State'
    localityName :PRINTABLE:'Locality Name'
    organizationName :PRINTABLE:'Some-Organization Pty Ltd'
    organizationalUnitName:PRINTABLE:'production'
    commonName :PRINTABLE:'hostName.domainName.com'
    emailAddress :IA5STRING:'[email protected]'
    Certificate is to be certified until Sep 29 18:20:01 2011 GMT (365 days)
    Write out database with 1 new entries
    Data Base Updated
    Client authentication failed, please verify your WebGate ID.

    Is the Access Server already in Simple Mode, and does the AccessGate definition in the Access System Console have "Simple" transport security mode set?
    Regards,
    Colin

  • Mail 2.1 and password error message when checking for incoming mail

    I get a "password rejection" error message when Mail 2.1 tries to check for incoming messages and there are no messages to retrieve (I have an Earthlink account). I don't have any problems sending messages. When I send a test message to myself, Mail can retrieve it. When I check mail a few minutes later, I get the "password rejection" message from Earthlink. This also happens when I use MS Entourage (v10.1.6). I have been using Entourage for years and just recently started using Mail and this password problems seemed to appear recently (last few weeks).
    Has anyone else experienced a similar problem? Since this happens in both Mail and Entourage, I don't know if it is Mac OS 10.4.10 or Earthlink. I tried Earthlink tech support and they were not much help.
    Thanks,
    Kenny

    Problem resolved by itself. I think it was a problem with my ISP.

  • Error Service Component Container for Java Mailer is not running

    Hi,
    I installed Oracle Workflow 2.6.3 (Standalone) in Oracle Database 10g Release 1.
    Actually there was no problem during the installation.
    I have done the Setting Up from step 1 to 8.
    I'm going to do the step 9 (Implementing Notification Mailer).
    The problem is the Workflow Agent Listener WFALSNRSVC is not running
    and I cannot run it using the Oracle Workflow Manager.
    In the Oracle Workflow Manager there was 4 rows which related to the Container : WFALSNRSVC
    1. Workflow Deferred Agent Listener
    2. Workflow Deferred Notification Agent Listener
    3. Workflow Error Agent Listener
    4. Workflow Inbound Notification Agent Listener
    The status is : Stopped.
    I cannot run any of them.
    Although the Startup Mode is Automatic, but none of them is running.
    When I tried to push the Go button to Actions: Start, it showed this message
    An error has occured
    The Service Component Container is not running.
    And after I tried to configure the Workflow Notification Mailer using the wizard
    I didn't receive any e-mail after I push the Test Send Mail button.
    I read in another post in this forum.
    It states that when going to the Workflow Configuration Assistant (WFCA)
    we must give the right entry in the LDAP paramaters and Java Mailer parameters,
    otherwise those WFALSNRSVC and WFMLRSVC would never run eventhough we enter them in a later time.
    Actually I didn't provide the paramaters (both of them) since they are optional.
    My questions are:
    1. Is there another way to run those service (servlet)?
    I really need the Java Notification Mailer to send email.
    2. Should I uninstall and reinstall my Oracle Workflow and provide those paramaters?
    Do I have to uninstall and reinstall the Oracle Workflow Middle Tier too?
    3. Is it okay if I drop and cascade the OWF_MGR user (my Workflow Manager schema)
    and then I use the Workflow Configuration Assistant again and choose Install option
    to create the OWF_MGR schema?
    3. Are the LDAP and OID required before we use the Java Notification Mailer?
    Actually I didn't understand the use of LDAP and OID which required in the LDAP paramaters?
    Any help would be grateful.
    Thanks,
    Buntoro

    In the service components page click on any container, select stop all from the LOV and Go. Once all the containers Workflow Agent Listener Service,
    Workflow Document Web Services Service and Workflow Mailer Service are Deactivated then StartAll. After all the containers are started then check the components status.
    Still if they are running bounce the apache.

  • Error when trying to send e-mail: javax.mail.MessagingException: can't dete

    Any help on the below error would be appreciated?
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.MessagingException: can't determine local email address
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at com.rightworks.maildispatcher.MailDispatcher$SenderThread.sendMessage
    (MailDispatcher.java, Compiled Code)
    at com.rightworks.maildispatcher.MailDispatcher$SenderThread.run(MailDis
    patcher.java:536)
    Cannot send mail file s1io.d.xml : Sending failed;
    nested exception is:
    javax.mail.MessagingException: can't determine local email address

    Appears to be related to specifing the mail.from input.
    Works now.

Maybe you are looking for