Error when trying to retrieve mail off of MSExchange Server.

I've been trying to connect to and download my email from a MSExchange Server. I used jGuru as a source for Java mail fundementals but I can't seem to make my program run. Here's my code, and below my code is the error I get during compilation:
public class attach
     public attach()
     public static void saveFile( String gg, Object hh )
     public static void main(String[] args)
               try
                    String host = "XBX09";
                    String username = "me";
                    String password = "";
//                    Create empty properties
                    Properties props = new Properties();
//                    Get session
                    Session session = Session.getDefaultInstance(props, null);
//                    Get the store
                    Store store = session.getStore("pop3");
                    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();
               catch(Exception ex)
                         System.out.println("EX!");               
java.lang.NoSuchMethodError: javax.mail.Session: method getDebugOut()Ljava/io/PrintStream; not found
     at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:184)
     at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:126)
     at javax.mail.Service.connect(Service.java:234)
     at javax.mail.Service.connect(Service.java:135)
     at attach.main(attach.java:42)
Exception in thread "main"

Seems like the port of your server is not the default
one...I made a few changes after looking at some other examples. I added some port information and it seems like I'm making progress because I'm getting a different
response (Debug message from Sun server...). Here's what it's saying after the program runs:
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc]
java.lang.NoSuchMethodError: javax.mail.Session: method getDebugOut()Ljava/io/PrintStream; not found
     at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:184)
     at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:126)
     at javax.mail.Service.connect(Service.java:234)
     at javax.mail.Service.connect(Service.java:135)
     at attach.main(attach.java:49)
Exception in thread "main"
public class attach
     public attach()
     public static void saveFile( String gg, Object hh )
     public static void main(String[] args)
               try
                    String host = "XBX09";
                    String username = "[email protected]";
                    String password = "";
//                    Create empty properties
                    Properties props = new Properties();
                    String sPort = ( (props.getProperty("mail.pop3.port") != null) ? props.getProperty("mail.pop3.port") : "995");
                    props.setProperty("mail.pop3.port",  sPort );
                    props.setProperty("mail.pop3.socketFactory.port",  sPort );
//                    Get session
                    Session session = Session.getDefaultInstance(props, null);
                    session.setDebug(true);
//                    Get the store
                    Store store = session.getStore("pop3");
                    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();
               catch(Exception ex)
                         System.out.println("EX!");               

Similar Messages

  • Ora 12154 error when trying to add a database to VS Server Explorer

    Hi Everyone,
    I get the Ora 12154 error when trying to add a database to VS Server Explorer.
    How do I get around this problem.
    The database service is running and I can connect to the database with pl/sql.
    I can also tnsping the database and that is also ok.
    Looks like a problem with the odp.net software.
    I am running the 32 bit Oracle 11g on a Windows7 Home Premium 64 bit PC.
    I am new to this stuff so please help me step by step.
    Thanks.
    Emad

    Hi J. B.
    I have a question related to this. After you told me about the //host:1521/database alias I tried it in a VB 2008 program and it worked and returned data. At least I know that it can be used in a VB program without issues. I just now need to be able to add a connection with the Server Explorer.
    Anyway here is the VB coding I used. I'm new to this and still learning:
    Imports Oracle.DataAccess.Client ' Visual Basic ODP.NET Oracle managed provider
    Public Class Form1
    ' String to connect to the database.
    Dim strConnectionString As String = _
    "Data Source=//emad-pc:1521/emadeva;User ID=scott;Password=tiger;" '
    ' Associate the connection string with a connection object.
    Dim objOracleConnection As New OracleConnection(strConnectionString)
    ' SQL query for returning data rows.
    Dim strSqlQuery As String = _
    "Select dname, deptno " & _
    "From dept " & _
    "Where deptno = 10" '
    ' Command object to make this query work.
    Dim objOracleCommand As New OracleCommand(strSqlQuery, objOracleConnection)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Identify what type of command is being used.
    objOracleCommand.CommandType = CommandType.Text
    Try
    objOracleConnection.Open()
    ' Set up a Data Reader and load it with data.
    Dim objOracleDataReader As OracleDataReader = _
    objOracleCommand.ExecuteReader()
    objOracleDataReader.Read()
    ' Convert the department number to a string.
    lblDepartmentNumberFromOracle.Text = _
    CStr(objOracleDataReader.Item("deptno"))
    Catch ex As Exception
    MessageBox.Show(ex.Message, "Error")
    End Try
    End Sub
    End Class
    I still want to thank you for the help you are providing.
    Truly,
    Emad

  • Error when trying to retrieve files from 1Tb Seagate hard drive

    15" MacBookPro mid 2009 OS 10.8.4.
    I can copy small files individually but get this error message for large files or folders. "The operation can’t be completed because the (filename) is in use".
    Some of these files were saved through Time Machine and some just copied across, but it doesn't seem to make a difference.
    I have tried many fixes (including Lgof etc. in terminal) but none work.  I have no applications open when trying to retrieve.  I have set my permissions properly, I have used Disk Utility to check permissions and repair them if necesarry.  I have read and write access to the drive.
    This has been going on for ages.  If I can't fix it, some of my files will be irretrieveable and I will have to copy small ones individually.
    Any ideas?
    P.S.  First time I've ever posted on an issue, so apologies if not enough information

    From the menu bar, select
     ▹ System Preferences ▹ Energy Saver ▹ Power Adapter
    and uncheck the box labeled Put the hard disk(s) to sleep when possible, if it's checked.
    If the drive has more than one interface (USB, FireWire, Thunderbolt, eSATA), try one of the other interfaces.
    Check that the data cable is securely inserted at both ends.
    Try a different cable.
    If you're connecting the drive through a hub, connect it directly to a built-in port on the Mac.
    If you're connecting it directly, try a different port.
    Disconnect all other devices on the bus, or as many as possible.
    Test the drive with another Mac. Test another drive with this Mac.
    If the drive is bus-powered, but has an AC adapter, connect the adapter.
    Start up in Safe Mode and test.
    If the drive doesn't work under any of the above conditions, and if another drive does work with the same Mac, then the drive has failed. You may be able to salvage the mechanism by removing it from the enclosure and installing it in another one, or in a drive dock.

  • Error when trying to retrieve UserName from MySAPSSO2 cookie

    Hi,
    I tried to retrieve the UserName from MySAPSSO2 cookie using the dotnet toolkit, but I keep getting the error "User Not Aunthenticated". I have placed the verify.pse files in a folder called psefiles in the same location as the bin folder of my application.
    I then also tried to directly use Convert.FromBase64String() to read the username from the cookie, but during conversion I get the error "Invalid character in a Base- 64 string"
    Any help is highly appreciated.
    Thanks,
    Kantishree D.

    From the menu bar, select
     ▹ System Preferences ▹ Energy Saver ▹ Power Adapter
    and uncheck the box labeled Put the hard disk(s) to sleep when possible, if it's checked.
    If the drive has more than one interface (USB, FireWire, Thunderbolt, eSATA), try one of the other interfaces.
    Check that the data cable is securely inserted at both ends.
    Try a different cable.
    If you're connecting the drive through a hub, connect it directly to a built-in port on the Mac.
    If you're connecting it directly, try a different port.
    Disconnect all other devices on the bus, or as many as possible.
    Test the drive with another Mac. Test another drive with this Mac.
    If the drive is bus-powered, but has an AC adapter, connect the adapter.
    Start up in Safe Mode and test.
    If the drive doesn't work under any of the above conditions, and if another drive does work with the same Mac, then the drive has failed. You may be able to salvage the mechanism by removing it from the enclosure and installing it in another one, or in a drive dock.

  • Error when trying to restore mail-folder

    Hi.
    I've done a complete re-installation af Snow Leopard.
    When trying to restore the mail folder via Time Machine i'm told: "The operation cannot be completed because you do not have sufficient privileges for "mail'" I seems to me that i have both privileges to read and write in the folder.
    I have no problems restoring my pictures and the likes?
    Can you please help me?
    Best regards Peter
    Message was edited by: guapost

    Check out http://docs.info.apple.com/article.HTML?artnum=307219

  • Casting error when trying to retrieve an EJB home interface from a servlet

              I am trying to call a method on a session bean from a servlet. I am receiving a Class Cast exception when trying to use the narrow method. I have this code working from an external java client. Is there something specific I have to do?
              

    Hi
              You must check the following rules :
              1) In JAR Files ( of your EJB ) check if there are remote mehods that return
              any class that is already used in servlets
              This classes must be remove from the servlet package ( if you are using WAR
              files ).
              2) Please read the BEA WebLogic Enterprise Java Beans Manual about the class
              loader and related problemas such as ClassCastException and
              ClassNotFoundException.
              Good Luck !
              Steve Schaber <[email protected]> escribió en el mensaje de noticias
              39ee4996$[email protected]..
              >
              > I am trying to call a method on a session bean from a servlet. I am
              receiving a Class Cast exception when trying to use the narrow method. I
              have this code working from an external java client. Is there something
              specific I have to do?
              >
              

  • Error when trying to set up OPC I/O server with LabView 2009

    Hi.I get an error when I try to set up OPC I/O server with LabView 2009 and the DSC module. If I open an empty project, right click ”My Computer”. Select new / I/O Server… and then OPC Client, the following error appears: Unable to browse OPC Server from the selected machine.Error -2147467262 occurred at GetOPCServerList.viPossible reason(s):LabVIEW: (Hex 0x80004002) No such interface supported.  I have tried to repair LabView, but with no luck. Any idea what it could be?

    The problems are not related to each otherOk then. Lets try getting this solved. Lemme dig......

  • Error when trying to add and edit users in Server 4.0

    I am having a strange problem with my OS X Server 4.0 Users section. I try to add a local network user but it automatically adds as a local user. Also, when I try to edit the User account (add to a group), I get the error, "The operation could not be completed. com.apple.Server.Accounts Error 2." Can anyone help and tell me what this means? As well, I can not edit any of my local network users, as I get greyed out buttons everywhere. I am definitely logged in as an administrator and I'm pretty sure my DNS records are accurate.
    Edit- Fixed! Turns out I had 2 users using the same Full Name, one as a local user (admin) and one that is a local network user. I ended up using the local network user one!
    Message was edited by: xoxorockoutloud123

    Sorry I don't have an answer, but I have the same problem.
    I thought it might be because I'm connected to an Active Directory, but the problem seems more fundamental.

  • S-1-1-0 Error when trying to delete folders on an NCP Server

    Hello:
    There are a couple of TIDS that point to this issue.
    The TID that references Windows 7 says "reported to Engineering"
    Problem:
    On trying to delete folders on an NCP Server (does not matter if you are admin or any other user) from a WIn 7 Client you get an error message about needing permission from S-1-1-0 in order to make changes to this folder.
    Seems to have been an issue with both XP and WIn 7 at one time but may have been resolved in XP.
    S-1-1-0 is the MS SID associated with the group Everyone which prior to XPSP2 included "anonymous" users.
    I am assuming that Win 7 follows the behaviour of post XP SP2 in not recognizing "anonymous" users as being members of Everyone thus the error message.
    Does anyone have the correct technical explanation for this problem. ?
    Renaming the folders allows you to delete them which makes me suspect that renaming alters a SID somewhere.

    Originally Posted by jmarton
    rdseepaul wrote:
    Thank you, jmarton, for your response.
    In our case we are using Client 2 SP2, so it looks like the "bugcat" came back.
    In fiddlying with it we have found that renaming a folder and all its sub folders that you may want to delete allows you to do so.
    > There are a couple of TIDS that point to this issue.
    > The TID that references Windows 7 says "reported to Engineering"
    > Problem:
    > On trying to delete folders on an NCP Server (does not matter if you
    > are admin or any other user) from a WIn 7 Client you get an error
    > message about needing permission from S-1-1-0 in order to make changes
    > to this folder.
    > Seems to have been an issue with both XP and WIn 7 at one time but may
    > have been resolved in XP.
    > S-1-1-0 is the MS SID associated with the group Everyone which prior
    > to XPSP2 included "anonymous" users.
    > I am assuming that Win 7 follows the behaviour of post XP SP2 in not
    > recognizing "anonymous" users as being members of Everyone thus the
    > error message.
    >
    > Does anyone have the correct technical explanation for this problem. ?
    There was a long standing problem with the Novell Client for Windows 7
    that wouldn't allow you to delete files which were read-only. An
    example would be some of the files located in a Windows roaming profile
    stored in a user's home directly on an OES2 server. The XP client
    would pop up a message asking if you wanted to do this, whereas on
    Windows 7 you could get the error about needing permission. Deleting
    from a command prompt worked ok.
    Fixes have gone into the latest Novell Client which should address
    this. Please make sure you are using Client 2 SP2.
    We're your Novell--again. re: focus
    Enhancement Requests: http://www.novell.com/rms

  • Getting an arrayindexoutofbounds error when trying to run mail app

    here is the code, it compiles fine, but when i run it, i get an array
    index out of bunds error
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class SimpleSender {
      public static void main (String args[]) throws Exception {
        String host = args[0];
        String from = args[1];
        String to = args[2];
        // Get system properties
        Properties props = System.getProperties();
        // Setup mail server
        props.put("mail.smtp.host", host);
        // Get session
        Session session = Session.getDefaultInstance(props, null);
        // Define message
        MimeMessage message = new MimeMessage(session);
        // Set the from address
        message.setFrom(new InternetAddress(from));
        // Set the to address
        message.addRecipient(Message.RecipientType.TO,
          new InternetAddress(to));
        // Set the subject
        message.setSubject("Hello JavaMail");
        // Set the content
        message.setText("Welcome to JavaMail");
        // Send message
        Transport.send(message);
    }this is the error message:
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
    at SimpleSender.main(SimpleSender.java:7)

    Which is line 7? I'll bet it's one of these three:  String host = args[0];
      String from = args[1];
      String to = args[2];which would mean you didn't pass enough command-line arguments to your program.

  • 2048 error when trying to play videos off network attached storage

    Here is the problem, when i try and play my converted mp4 videos off my nas box i get the error-2048(not a file quicktime understands) but if i copy these files to my computer they play without a problem. I am totally stumped with this problem and will love to no what is causing this and is there a way to fix this problem.

    Had the same issue and found this information.  Just tested and it worked for me. Hopfully helps some else also!
    Answer: Change your DNS setting in the iPhone/iPad Wi-Fi settings.
    That worked for me. My original DNS settings were assigned by my WIFI router a. I removed these and placed in: 208.67.222.222 (Open DNS server IP)
    To make this adjustment go to Wi-Fi, locate your selected Wi-Fi network and click the blue arrow beside it to being up advanced settings, click in the DNS area to change it.
    To read the original thread, follow this link: (answer on page 2)
    https://discussions.apple.com/thread/3400114?start=0&tstart=0

  • Error when trying to retrieve Document Library in Sharepoint Hosted App using REST

    I have created the following REST request in order to retrieve the root folder of a Document Library added to a Sharepoint Hosted App
    getProductDocumentFolder: function () {
    $.ajax({
    url: _spPageContextInfo.webServerRelativeUrl +
    "/_api/web/GetFolderByServerRelativeUrl('/Lists/ProductDocuments')",
    type: "GET",
    headers: {
    "accept": "application/json;odata=verbose",
    success: function () {
    alert("Success!");
    //REST.Operator.readAll();
    error: function (err) {
    alert("Oops, error!");
    alert(JSON.stringify(err));
    The Document Library was added to the App from the Add > New Item menu in Visual Studio. I selected List and Selected Document Library from the Create a customizable list... dialog. The list is defined as shown in the picture below.
    I get the generic error "Value does not fall within the excepted range".
    I have tried both 
    "/_api/web/GetFolderByServerRelativeUrl('/Lists/ProductDocuments')"
    and
    "/_api/web/GetFolderByServerRelativeUrl('/ProductDocuments')"
    for the Document Library URL both I get the same error in both cases.
    What am I missing here?

    Problem solved. 
    It turns out there should be NO leading '/' in the relative URL despite the example shown in http://msdn.microsoft.com/en-us/library/office/dn292553.aspx#Folders with "/Shared Folder".
    The correct GetFolderByServerRelativeUrl-parameter in my case is 'Lists/Productdocuments'.
    Unsure whether example is wrong or if it applies to other cases than mine.

  • Error when trying to retrieve data from Essbase

    Hi There
    I running OBIEE 10.1.3.4.0 and Essbase 9.3.1. When im trying to update member count for instance(from administration tool) it gives me the following errors.
    nQSError 10058, nQSError 43093 and Essbase Error 1260046. This is when im testing against an Essbase I have developed for my self. If I try using one of the supplied sample databases it works fine...
    Does anybody have an idea about what could be wrong?
    Any pointers would be much appreciated!
    Regards, Jacob

    Hi,
    That warning / error message will be coming from the MDX interface on the BW server.  It does not originate from BOBJ.
    This question would be better asked to support component BW-BEX-OT-MDX
    Similar discussion can be found using search: Limitation of Number of Objects used in Webi with SAP BW Universe as Source
    Regards,
    Henry

  • Error when trying to send mail

    I have recently got Sky broadband and everything is working fine except I can't send mail I get this error
    "The server "smtp.sky.com" refused to allow a connection on port 465."
    Now I have checked my mail settings and all seems fine and sky tech help want give me specific help with Macs, any help would be gratefull
    Thanks Anthony.

    Disable SSL for SMTP. After disabling make sure, SMTP port is 25. If this does not work, try port 587 for SMTP (SSL still disabled).

  • TS4002 Anyone has this error when trying to enable Mail/Notes in iCloud? "Your email address must be less than 21 characters"

    Is this a bug?
    Any workarounds?

    You're being asked to create a [email protected] address and you're entering an address at your domain. The 'something' must be less than 21 characters and can only be followed by '@icloud.com'.

Maybe you are looking for

  • Cannot send email from icloud account from mac

    cannot send email from icloud account from mac running 10.8.2

  • I am being harassed by customer service the day after my bill is due every month.

    At least 6 phone calls every day, beginning at 5am, followed by text messages. All you have to you is tell me once, via text, that my payment is due. I indicated on my Verizon Wireless account online that my preferred method of contact is text messag

  • Wma to itunes mac

    convert wma to itunes mac - getting the runaround and false information.  suggestions?  ive already purchased the apple recommended flip4mac which i find out later doesnt do what it claims...

  • Default values on insert

    This has probably been asked and answered, but I couldn't find the answer when searching the newsgroups. On most of my database tables, there is a date column to store the date when a row was added (it is never changed after insert). Without Kodo JDO

  • Third Party U 64 Control, Used bits 25 most significant

    I spent the whole day at work trying to work out some calculation and the simple fact that I dont know and could not find any literature on using  x number of bits from a U64, I returned home with no results for today. Dear Experts Please help. I hav