This small and simple file doesn't compile .......please help

Iam trying to complie this file but it gives error while compiling ....please help
I wanted to generate this error message in my log file and wanted to see how the error message looks like ....that is why iam forcefully throwing en exception .....but the file is not compliling.
HERE IS THE FILE .....
package myemailutils;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.naming.*;
* Class BeaSendMail
* @author Shailesh Sharma
* @version
public class BeaSendMail
public BeaSendMail() {}
     private String successMessage = "";
     public void sendMail(String msgSubject, String msgTxt, String currentEmailAddr, String targetEmailAddr, String targetCc, String targetBcc) throws Exception
     Message msg;
     try{
// lookup mail session in JNDI
InitialContext context = new InitialContext();
Session session = (Session) context.lookup("BibleMailSession");
// set message
msg = new MimeMessage(session);
     try {
// set message with to, subject, and message text
msg.setFrom(new InternetAddress(currentEmailAddr));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(targetEmailAddr, false));
     msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(targetCc, false));
msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(targetBcc, false));
msg.setSubject(msgSubject);
msg.setSentDate(new Date());
msg.setText(msgTxt);
          throw new Exception();
     // send message
Transport.send(msg);
successMessage = "Message sucessfully sent.";
session = null;
} catch (Exception e) {
                    try {
                         // override mail session properties
                         Properties mailProps = new Properties();
                         mailProps.put("mail.transport.protocol", "smtp");
                         mailProps.put("mail.host", "smtprelay2.aici.com");
                         mailProps.put("mail.user", "Anthem Help Desk");
                         // mailProps.put("mail.from", "[email protected]");
                         mailProps.put("mail.debug", "true");
                         mailProps.put("mail.smtp.auth", "true");
                         // set message with to, subject, and message text
                         msg.setFrom(new InternetAddress(currentEmailAddr));
                         msg.setRecipients(Message.RecipientType.TO,
                                                  InternetAddress.parse(targetEmailAddr, false));
                         msg.setRecipients(Message.RecipientType.CC,
                                                  InternetAddress.parse(targetCc, false));
                         msg.setRecipients(Message.RecipientType.BCC,
                                                  InternetAddress.parse(targetBcc, false));
                         msg.setSubject(msgSubject);
                         msg.setSentDate(new Date());
                         msg.setText(msgTxt);
                         throw new Exception();
                         // send message
                         Transport.send(msg);
                         successMessage = "Message sucessfully sent.";
                         session = null;
                    } catch (Exception ex) {
// successMessage = ex.getMessage();
// Reporter.easyReport(ReportType.DEBUG, "Error while sending mail to " +
System.out.println("Error while sending BeaSendMail weblogic mail to " +
// System.getProperty(MWEProperties.SMTPServer1) + ": " + ex.getMessage());
ex.getMessage());
     } catch (Exception exc) {
// successMessage = "Problem Looking up... " + exc.getMessage();
// Reporter.easyReport(ReportType.DEBUG, "Error while sending mail to " +
System.out.println("Error while Looking up JNDI NAME in BeaSendMail mail " +
// System.getProperty(MWEProperties.SMTPServer1) + ": " + ex.getMessage());
exc.getMessage());
}//end sendMail
}

yes i have changed the code ....but now it is giving some error saying Authentication Failed ...the exact error is :
Error while sending BeaSendMail weblogic mail to Sending failed;
nested exception is:
     javax.mail.AuthenticationFailedException
Iam using somethin like ...
} catch (Exception e) {
InitialContext contextnext = new InitialContext();
InitialContext contextnext = new InitialContext();
Session sessionnext = (Session) contextnext.lookup("BibleMailSession");
Properties mailProps = new Properties();
mailProps.put("mail.host", "smtprelay2.aici.com");
// i think the following gives an error with some AUTHENTICATION
Session authSession = sessionnext.getInstance(mailProps);
msgnext = new MimeMessage(authSession);
// set message with to, subject, and message text and send it ...

Similar Messages

  • IQ816 just wont start....wake up this morning and just wont start...please help

    IQ816 just wont start....wake up this morning and just wont start...please help

    it was working well last night...
    i just press sleep mode on keyboard before i go sleep...
    now nothing...
    just like there s no electricity....

  • My iTunes won't even load anymore, when I click the icon, it looks like it will open and then it doesn't. Please Help!

    iTunes will not open at all. It looks like it will and then it doesn't (the windows loading symbol appears and then it disappears). I even tried uninstalling iTunes and downloading it again and installing it, nothing works! Please Help!

    1. First check if this file APSDaemon.exe is the problem here.
    Close your iTunes.
    Press Ctrl-Alt-Del key and choose Task Manager. In the "Processes" Tab, select the file APSDaemon.exe and click End Prosses button, then close the task manager window.
    Now open itunes and see if it is working?
    If that works, to prevent having to do the same process everytime you restart Windows, go to. START button, type in
    MSCONFIG
    Hit ENTER
    Click STARTUP Tab, Uncheck "Apple Push", click OK.
    Restart Windows.
    2. If that fails, refer to following article to remove SC Info.lib file:
    http://support.apple.com/kb/TS2363
    3.  If that fails, repair or reinstall your Quicktime.  START / CONTROL PANEL / PROGRAMS N FEATURES / hightlight QUICKTIME and click REAPIR.

  • Ziping and unziping files in a directory Please help

    I have a program to zip files in a directory and create a .zip file.
    But am not able to unzip the file back to the orginal files. This file can be unziped using any unzip tool. But i want to unzip it using java itself
    thanks
    the code is as follows ......
    import java.util.zip.*;
    import java.io.*;
    public class Zipper
    private String dirname;
    public void compress_file(String input_dirname,String outfilename)
         //getting all the file names
         this.dirname=input_dirname;
         File f1=new File(dirname);
         String s[]=f1.list();
         try
              byte[] buf = new byte[4096]; //read buffer
              int retval; //return value
              FileOutputStream os = new FileOutputStream(outfilename);
              ZipOutputStream zos = new ZipOutputStream(os);
              FileInputStream is= new FileInputStream("File1");
              for(int i =0;i<s.length;i++)
                   System.out.println(s);
                   is = new FileInputStream("./conf/"+s[i]);
                   zos.putNextEntry(new ZipEntry("./conf/"+s[i]));
                   do
                        //read file in from input stream
                        retval = is.read(buf, 0, 4096);
                        //-1 indicates end of file
                        if (retval != -1)
                        //write buffer to output stream
                             zos.write(buf, 0, retval);
                   }while (retval != -1);
              //close this ZipEntry
              zos.closeEntry();
              //close input stream
              is.close();
              //close output stream
              zos.close();
         catch(Exception e)
              System.out.println("Exception occurred: " + e);
    public static void main(String[] argv)
         Zipper zp= new Zipper();
         zp.compress_file("./conf/","sample.zip");

    I'm kinda unclear about what problem you are having, but try this link
    http://developer.java.sun.com/developer/technicalArticles/Programming/PerfTuning/#Compression

  • Unable to burn DVDs because I renamed the drive the project and burn files are on. Please help.

    I am unable to burn DVDs because, not thinking, I renamed the external drive the project is on. How do I fix the problem in DVD Studio Pro 4? I changed the name back on the drive, the files show as linked, but it won't burn. I've tried to refresh the assets, didn't help. Relink is not available to try. I tried to go to file/advanced burn & build, but it was not available either. I'm new to all this so am very afraid to trash the preferences, not knowing if I'm going to do other harm.
    Thanks,
    Trish C

    Reimport the files and drop them into the project.
    Your links should work.
    x

  • I am unable to access my emails since last update talk talk have checked thier end and say mozilla is the problem please help. I am able to log on to web mail but unable to go any further, what do i do?

    I can log on to my email addresses and can see my inbox button but nothing happens when i click on the button on any of my 3 email addresses. Talk talk support has gone through everything with me and says all ok there end they can access my emails and says my mozilla browser is corrupted. What do I do?

    Apparently TalkTalk mail will work with Firefox 4 and Firefox 5 ''if'' you set the browser to ''lie'' to TalkTalk mail by saying that you are still using version 3.6.
    You can find the instructions for that in a post on the TalkTalk forums: [http://www.talktalk.co.uk/forums/showthread.php?t=185113#post2452787 Firefox 4 & TalkTalk webmail - Forums].
    Note: when you open about:config the first time, it will display a warning message that you should be careful with the changes you make. That's definitely good to bear in mind.
    Does it work?

  • Attempting to upgarde itunes and I get an error message looking for "an alternate path to a folder containing 'iTunes.msi' location.  I've searched my hard drive and the file doesn't exist.  What to do?

    Attempting to upgarde itunes and I get an error message looking for "an alternate path to a folder containing 'iTunes.msi' location.  I've searched my hard drive and the file doesn't exist.  What to do?

    This worked...found on a prior discussion:
    Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page)...
    http://majorgeeks.com/download.php?det=4459
    From the link above (near the top of the page)....Under 'download locations'   click on 'download@majorgeeks'
    To install the utility, doubleclick the msicuu2.exe file you just downloaded and ran.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    Restart your computer.
    Re-download Itunes (latest version form Itunes website) and install.  It worked!

  • My iPhone has a black background and the classic rotating wheel. I try it to put it in DFU but when I turn it on it goes back in this modality and my mac doesn't recognize the phone. HELP ME

    my iPhone has a black background and the classic rotating wheel. I try it to put it in DFU but when I turn it on it goes back in this modality and my mac doesn't recognize the phone. HELP ME!

    That is correct.
    That is the price of a replacement iphone once your iphone is outside of the warranty period

  • We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again. this is the message its shows when i upload proper format. i do not whom i should ..........

    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.

    I got uploaded after many ways. Just logged in windows PC and opened Internet explorer and uploaded it worked.

  • Bambus - A small and simple GTK Gui to change Wallpapers using feh,...

    It is a old project, which I wrote a year ago.
    Bambus - A small and simple GTK Gui to change Wallpapers using feh, Esetroot, hsetroot, habak or any other command tool.
    Aur package: bambus
    To restore a Wallpaper at a WM start-up (Openbox, Awesome,...) execute the command
    bambus -restore
    To restore a Wallpaper randomly execute
    bambus -any
    To restore Wallpapers in a special order execute
    bambus -each
    Screenshots:
    Last edited by ying (2010-11-10 06:35:06)

    Hey thx a lot for your posts.
    @ApotheoZ: Hmm I don't know where I got them from(Take a look at wallbase.com). But I'll load it up for you.
    Last edited by ying (2010-11-10 16:36:26)

  • Hi I got an email from itunes saying that my pre order was ready and when I click on the link from my ipad it takes me to the itunes store app and then it doesn't do anything help with this please.

    Hi I got an email from itunes saying that my pre order was ready and when I click on the link from my ipad it takes me to the itunes store app and then it doesn't do anything help with this please .
    <Link Edited By Host>

    Thanks for your advice, I went to the apple shop today for a face to face meeting with a tech and he checked everything and could not figure out why I was having this problem so we decided to give up on that account and create a whole new one for me using a different email address.
    Now I can download apps on both my iPhone and ipad2.
    If anyone is reading this in Brisbane Australia go to the Chermside apple shop and ask for Wade. He was fantastic!
    Jan

  • Why is my iPod Touch's memory 0 when i only have 249 mb of photos and camera and 23l mb of Music? Please help this is a big issue! what do i do? ps i dont want to loose 2 of my apps!!

    I have a 8GB Ipod Touch and i know its not a lot, but in the beginning it was working fine. For some time now it wont let me excede even 1GB of memory. i have no games, no apps, not many contacts, hardly anything! only 249 mb of photos and camera and 23l mb of Music. i have backed it up and restarted it and everything and i am getting annoyed! please help me!! i cant live without my ipod!!! This is urgent!
    P.S: i have 2 apps on my ipod that i would not like to loose! IF theres anyway to save them in the process of fixing my ipod that will be great!
    Thank you!

    An "other" that large usually indicates that the "other" includes corrupted files.  Usually restoring from backup eliminated the corrupted files. However, sometimes restoring to factory settings/new iPod is required.
    To restore from backup see:
    iOS: How to back up
    To restore to factory settings/new iPod see:
    iTunes: Backing up, updating, and restoring iOS software

  • HT1553 Hi, I'm stuck at step 9. I don't see my external harddrive when I want to save the DMG backup file. Can you please help me with this? I'm desperate to make this backup! Big thanx in advance!

    Hi, I'm stuck at step 9. I don't see my external harddrive when I want to save the DMG backup file. Can you please help me with this? I'm desperate to make this backup! Big thanx in advance!
    http://support.apple.com/kb/HT1553

    Repair permissions and restart your computer.  If this does not work, zap the pram.  You should now see your external hard drive. 

  • I have QuickTime Player 7.6.8, I cannot update or remove it b/c I am missing QuickTime.msi file. It is gone and I need it back. Please help.

    I have QuickTime Player 7.6.8, I cannot update or remove it b/c I am missing QuickTime.msi file. It is gone and I need it back. Please help.

    Unfortunately, this sort of trouble has gotten more complicated to deal with ever since Microsoft pulled the Windows Installer CleanUp utility from their Download Center on June 25. First we have to find a copy of the utility.
    Let's try Googling. (Best not to use Bing, I think.) Look for a working download site for at least version 3.0 of the Windows Installer CleanUp utility. After downloading the utility installer file (msicuu2.exe), scan the file for malware, just in case. (I use the free version of Malwarebytes AntiMalware to do single-file scans for that.)
    If the file is clean, to install the utility, doubleclick the msicuu2.exe file you've downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any QuickTime entries and click "Remove".
    Quit out of CleanUp, restart the PC and try installing iTunes again. Does the install go through properly now?
    (If you do find a clean download site for the correct version of CleanUp, please don't tell me where it is. Without wishing to sound paranoid (although I grant it does sound paranoid), there is a non-zero chance that posting links to download locations for the utility here at Discussions leads to that download location being shut down.)

  • I can not attach any files to email or Facebook. When I go to "browse" the window comes up and disappears immediately. I updated browser and Adobe Flash. Restarted computer and zapped pram. any ideas? Please help!

    I can not attach any files to email or Facebook. When I go to "browse" the window comes up and disappears immediately. I updated browser and Adobe Flash. Restarted computer and zapped pram. any ideas? Please help!

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. For instructions, launch the System Preferences application, select Help from the menu bar, and enter “Set up a guest account” (without the quotes) in the search box. Don't use the Safari-only Guest login created by Find My Mac.
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem(s)?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault in Mac OS X 10.7 or later, then you can’t enable the Guest account. The Guest login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, or if a firmware password is set, you can’t boot in safe mode.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of steps 1 and 2.

Maybe you are looking for