Problem to access POP3 of MS Exchange Server using Java Mail

{color:#0000ff}Hi,
I have a requirement to read emails from my office mailbox using POP3 protocol which is in Microsoft Exchange Server.
My code is given below.{color}
{color:#0000ff}*package emailadaptor;*
import java.util.Properties;
import javax.mail.Session;
import javax.mail.Store;
*public class Test {*
*public static void main(String[] args) {*
* // POP3 server name of Exchange Server*
* String host = "popServer.domain.com";*{color}
{color:#0000ff}*
* // User name*
* String user = "domainName\\userName";*
* String password = "password";
* // Get a session. Use a blank Properties object.*
* Session session = Session.getDefaultInstance(new Properties());
* try{*
* // Get a Store object*
* Store store = session.getStore("pop3");*
* store.connect(host, user, password);*
* }catch(Exception e){*
* e.printStackTrace();*
*{color:#0000ff}I can ping popServer.domain.com from my machine where I am testing the code.*
For username I have tried with domainName\\userName and username pattern both but unsuccessful. For example if my username if user1 and my domain name is domain1 than the two patterns I have tried are ‘domain1\\user1’ and ‘user1’.
For both these cases I am getting same error, and below is my error stack Trace.
*{color}*
*{color:#ff0000}javax.mail.AuthenticationFailedException: The requested mailbox is not available on this server.*
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:158)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at emailadaptor.Test.main(Test.java:19)
*{color}*
*{color:#0000ff}Please give me some idea and steps what is wrong with this code and if any other information is needed then also let me know that.*
Please help.
Regards,
*Gourab{color}
*{color}

Turn on session debugging. What does the protocol trace show?
Are you able to connect with other mail clients, such as Thunderbird?
(Outlook doesn't count.)

Similar Messages

  • HI, Iam  trying to Integrate Exchange server using Java Mail

    Here is what iam stuck with, I have a problem while conneting to Exchange Server using imap over ssl.
    My code looks like this
    props.put("mail.imap.host",host);
    props.put("mail.imap.sasl.authorizationid","user1");
    props.put("mail.imap.sasl.enable","true");
    props.setProperty("mail.imap.socketFactory.class","javax.net.ssl.SSLSocketFactory");
    props.setProperty("mail.imap.socketFactory.fallback","true");
    props.setProperty("mail.imap.socketFactory.port","993");
    Authenticator auth = new myauthenticator(AdminUserName,AdminPassword);
    Session session = Session.getInstance(props,auth);
    session.setDubug(true);
    Store store = session.getStore("imap");
    store.connect();
    I get the following Exception as
    javax.mail.MessagingException: Software caused connection abort: recv failed;
    nested exception is:
    java.net.SocketException: Software caused connection abort: recv failed
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:571)
    at javax.mail.Service.connect(Service.java:310)
    at javax.mail.Service.connect(Service.java:169)
    at javax.mail.Service.connect(Service.java:118)
    at MoveCalendar.move(MoveCalendar.java:63)
    at SendCalendar.send(SendCalendar.java:74)
    at SendCalendar.main(SendCalendar.java:40)
    Caused by: java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at com.sun.net.ssl.internal.ssl.InputRecord.a(Unknown Source)
    at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
    at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    at com.sun.mail.iap.ResponseInputStream.readResponse(ResponseInputStream.java:97)
    at com.sun.mail.iap.Response.<init>(Response.java:96)
    at com.sun.mail.imap.protocol.IMAPResponse.<init>(IMAPResponse.java:61)
    at com.sun.mail.imap.protocol.IMAPResponse.readResponse(IMAPResponse.java:135)
    at com.sun.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:261)
    at com.sun.mail.iap.Protocol.<init>(Protocol.java:114)
    at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:104)
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:538)
    ... 6 more
    DEBUG: setDebug: JavaMail version 1.4.1
    DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc]
    DEBUG: mail.imap.fetchsize: 16384
    DEBUG: enable SASL
    DEBUG: mail.imap.sasl.authorizationid: user1
    If i change the sessionFactory.class or if I remove this property I donot get any Exception It gets Executed well, but IT goes directly to the Adminstrators Mail account but not to the AuthorizationId I gave it. Can any one give me sugssion upon this issue.I don't understand whether the problem was with the Exchange Server I was trying to connect or with my local Environment

    hi,
    Iam very thankful for your reply here's the requested debug steps
    DEBUG: setDebug: JavaMail version 1.4.1
    DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc]
    DEBUG: mail.imap.fetchsize: 16384
    DEBUG: enable SASL
    DEBUG: mail.imap.sasl.authorizationid: user1
    DEBUG: protocolConnect returning false, host=india.lendingspace.com, user=PMaganti, password=<null>
    * OK Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0 (lsinmail.india.lendingspace.com) ready.
    A0 CAPABILITY
    * CAPABILITY IMAP4 IMAP4rev1 IDLE LOGIN-REFERRALS MAILBOX-REFERRALS NAMESPACE LITERAL+ UIDPLUS CHILDREN AUTH=NTLM
    A0 OK CAPABILITY completed.
    IMAP DEBUG: AUTH: NTLM
    DEBUG: protocolConnect login, host=****, user=AdminUserName, password=<non-null>
    IMAP SASL DEBUG: Mechanisms: NTLM
    IMAP SASL DEBUG: No SASL support
    A1 LOGIN AminUserName AdminPassword
    A1 OK LOGIN completed.
    A2 CAPABILITY
    * CAPABILITY IMAP4 IMAP4rev1 IDLE LOGIN-REFERRALS MAILBOX-REFERRALS NAMESPACE LITERAL+ UIDPLUS CHILDREN AUTH=NTLM
    A2 OK CAPABILITY completed.
    IMAP DEBUG: AUTH: NTLM
    DEBUG: connection available -- size: 1
    A3 SELECT INBOX
    * 1 EXISTS
    * 1 RECENT
    * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
    * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
    * OK [UNSEEN 1] Is the first unseen message
    * OK [UIDVALIDITY 261914] UIDVALIDITY value
    A3 OK [READ-WRITE] SELECT completed.
    No of Messages msgs 1
    A4 FETCH 1 (ENVELOPE INTERNALDATE RFC822.SIZE)
    * 1 FETCH (ENVELOPE ("5 Mar 2009 13:25:19 +0530" "Outlook Calendar Events Using Java" ((NIL NIL "XXXXX" "XXXXX")) ((NIL NIL "XXXXX" "XXXXX")) ((NIL NIL "XXXXX" "XXXXX")) ((NIL NIL "XXXX" "XXXX")) NIL NIL NIL "<XXXXX>") INTERNALDATE " 5-Mar-2009 13:25:19 +0530" RFC822.SIZE 1348)
    A4 OK FETCH completed.
    FROM: XXXX
    SUBJECT: Outlook Calendar Events Using Java
    DATE: Thu Mar 05 13:25:19 IST 2009
    A5 FETCH 1 (BODYSTRUCTURE)
    * 1 FETCH (BODYSTRUCTURE (("TEXT" "CALENDAR" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 598 10 NIL NIL NIL) "mixed" ("boundary" "----=_Part_0_18680399.1236239719654") NIL NIL))
    A5 OK FETCH completed.
    [ Multipart Message ]
    CONTENT:TEXT/CALENDAR; charset=US-ASCII
    A6 STORE 1 +FLAGS (\Answered)
    * 1 FETCH (FLAGS (\Answered \Recent))
    A6 OK STORE completed.
    A7 COPY 1 CALENDAR
    A7 OK [COPYUID 262745 258 23] COPY completed, 1 messages copied.
    A8 EXAMINE INBOX
    * 1 EXISTS
    * 0 RECENT
    * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
    * OK [PERMANENTFLAGS ()] Permanent flags
    * OK [UNSEEN 1] Is the first unseen message
    * OK [UIDVALIDITY 261914] UIDVALIDITY value
    A8 OK [READ-ONLY] EXAMINE completed.
    A9 CLOSE
    A9 OK CLOSE completed.
    DEBUG: added an Authenticated connection -- size: 1
    A10 LOGOUT
    * BYE Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0 signing off.
    A10 OK LOGOUT completed.
    DEBUG: IMAPStore connection dead
    DEBUG: IMAPStore cleanup, force false
    DEBUG: IMAPStore cleanup done
    Actually what iam doing is read a mail which was more recent in inbox and If it is an Calendar event Iam copying that mail to Calendar Folder. So that Microsoft OUTLOOK automatically recongnizes them and secudles them in it's Calendars
    This is actually done for adminstrator's Account but not for the user1
    As you have suggested I removed the socketFactory class stuff and did this.
    and this is my modified Code
    props.put("mail.imap.host",imapHost);
    props.put("mail.imap.sasl.enable", "true");
    props.put("mail.imap.sasl.authorizationid", "user1");
    Authenticator auth=new myauthentication(imapUserName,imapPassword);
    Session session = Session.getInstance(props,auth);
    session.setDebug(true);
    store = session.getStore("imap");
    store.connect();
    And that goes like that.

  • How can i access gmail's smtp server using java mail api

    i m using java mail api to access gmails pop and smtp service to receive and send mail from ur gmail account. I m able to access gmails pop server using the ssl and port 995 , but i can not use its smtp server to which i m connecting using ssl on 465 port. It requires authentication code.
    if anybody can help me in this regard i m thnkful to him/her.
    thnks in advance.
    jogin desai

    Here's an example of using SSL + Authentication
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=ssl+authentication&subCat=siteforumid%3Ajava43&site=dev&dftab=siteforumid%3Ajava43&chooseCat=javaall&col=developer-forums

  • Cannot Access EAC/ECP on exchange server 2013 after installation

    Hi,
    I can not Cannot Access EAC/ECP on exchange server 2013 after installation . Error 404.4  code 0x80070002
    Help!
    Thanks,

    Hi  Florin
    Did you try accessing EAC by using below link 
    https://<Exchange_2013_CAS_FQDN>/ecp?ExchClientVer=15
    Please access EAC via Internal URL: https://<CASServerName>/ecp
    Finally ensure that you have logged in as administrator as well as this might be problem as well
    Remember to mark as helpful if you find my contribution useful or as an answer if it does answer your question.That will encourage me - and others - to take time out to help you Check out my latest blog posts on http://exchangequery.com

  • Will CF9 cfexchangecalendar access public calendars in Exchange Server 2007?

    We need to create something in CF9 that will allow us to access public calendars in Exchange Server 2007. I've Googled it but only come up with dead ends. Any help would be appreciated.

    I ran into the same situation recently, and found out that you need to make sure InternalClientsRequireSSL is set to false.
    To verify: Run Get-OutlookAnywhere | fl Identity, *ssl
    If it is true, try setting it to false.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread

  • Unable to connect to the Exchange server using HTTP/HTTPS protocol.

    hi,
    i try to connect microsoft exchange server, but it give me
    error
    Unable to connect to the Exchange server using HTTP/HTTPS
    protocol.
    my code is pasted below............
    <!--- connection parameters --->
    <cfparam name="user1" default="uHRH">
    <cfparam name="user2" default="uHRH">
    <cfparam name="password" default="uHRH">
    <cfparam name="exchangeServerIP" default="192.168.0.1">
    <cftry>
    <!--- Open a connection to the exchange server by
    specifying the required user credentials --->
    <cfexchangeConnection
    action="open"
    username ="#user1#"
    password="#password#"
    server="#exchangeServerIP#"
    <!--- protocol = "http"--->
    connection="conn1">
    <cfoutput>Connection to exchange server
    "#exchangeServerIP#" established</cfoutput>
    <!--- Close connection to exchange server --->
    <CFExchangeConnection
    action="close"
    connection="conn1">
    <cfoutput>Connection to exchange server
    "#exchangeServerIP#" terminated</cfoutput>
    <!--- Error Information --->
    <cfcatch type="any">
    <cfoutput>#cfcatch.message#</cfoutput>
    </cfcatch>
    </cftry>
    if any one know how to solve this error?

    Hi,
    The "<cfexchangeConnection>" tag supports both "HTTP"
    and "HTTPS" connection.. So Please make sure the username has the
    "Outlook Web Access".
    Also try removing the <!--- protocol = "http"--->
    comment which you placed inside the "<cfexchangeConnection>"
    tag.

  • Connectiong to Exchange Server through JAVA

    Hi friends,
    I am new to java mail.i have a problem with connecting to exchange server thru java. my java program sends a mail.but i want to get an alert when ever received a mail and also download the mail to local disk from exchange server.
    so if you can please help me.Reply to this ,send me the links or sample codes / paste here itself.
    Advance Thanks,
    Sankar.P

    Hi friends,
    I am new to java mail.i have a problem with connecting to exchange server thru java. my java program sends a mail.but i want to get an alert when ever received a mail and also download the mail to local disk from exchange server.
    so if you can please help me.Reply to this ,send me the links or sample codes / paste here itself.
    Advance Thanks,
    Sankar.P

  • Access, execute mof from pull server using release management

    I have created a DSC pull server and deployed a mof to this server.
    I could access the mof from pull server using below script and it executed successfully from powershell ISE.
        1. 
    Configuration
    C_Pull_Webserver
        2. 
        3. 
    LocalConfigurationManager
        4. 
        5. 
    AllowModuleOverwrite=$true;
        6. 
    ConfigurationID
    = "db00cf80-cb0e-4537-8344-90e3906e0b34";       
        7. 
    RefreshMode
    = "Pull";
        8. 
    DownloadManagerName
    = "WebDownloadManager";  
        9. 
    RefreshFrequencyMins
    = 15;
        10.
    ConfigurationModeFrequencyMins
    = 30;
        11.
    ConfigurationMode
    = "ApplyAndAutoCorrect";
        12.
    DownloadManagerCustomData
    = @{
        13.
    ServerUrl
    = "http://myserver:8080/PSDSCPullServer/PSDSCPullServer.svc";
        14.
    AllowUnsecureConnection
    = "TRUE" }          
        15.
        16.
        17.
    #Create MOF to push
        18.
    C_Pull_Webserver
        19.
    #push the MOF: this will engage pull mode
        20.
    $FilePath
    = (Get-Location
    -PSProvider FileSystem).Path
    + "\C_Pull_Webserver"
        21.
    Set-DscLocalConfigurationManager
    -ComputerName "CHN-AERO-VM13"
    -Path $FilePath
    -Verbose
    I removed the below lines from the above script
    19.
    #push the MOF: this will engage pull mode
    20.
    $FilePath
    = (Get-Location
    -PSProvider FileSystem).Path
    + "\C_Pull_Webserver"
    21.
    Set-DscLocalConfigurationManager
    -ComputerName "CHN-AERO-VM13"
    -Path $FilePath
    -Verbose
    andand tried  to access it from release management and i get the below error
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException:
    Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
    Failed to apply configuration in the DSC script to the computer. Consult the Logs below for details of the error.
    System.Management.Automation.RemoteException: Unable to find the mof file. Make sure you are generating the MOF in the DSC script in the current directory.
       at System.Management.Automation.PowerShell.CoreInvokeRemoteHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
       at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)

    Don't know. How did you generate the MOF?
    When I run this it works just fine:
    Configuration C_Pull_Webserver{
    LocalConfigurationManager{
    AllowModuleOverwrite=$true;
    ConfigurationID = "db00cf80-cb0e-4537-8344-90e3906e0b34";
    RefreshMode = "Pull";
    DownloadManagerName = "WebDownloadManager";
    RefreshFrequencyMins = 15;
    ConfigurationModeFrequencyMins = 30;
    ConfigurationMode = "ApplyAndAutoCorrect";
    DownloadManagerCustomData = @{
    ServerUrl = "http://myserver:8080/PSDSCPullServer/PSDSCPullServer.svc";
    AllowUnsecureConnection = "TRUE"
    C_Pull_Webserver
    ¯\_(ツ)_/¯

  • How can I authenticate to a XI server using java via SOAP (SAAJ)

    Hi everybody!
    I need to connect (SOAP) to a XI server using JAVA
    I'm using SAAJ api.The problem is XI server need authentication but I can't found the way to do it! this is a part of code
    SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection connection = soapConnFactory.createConnection();
    URL destination = new URL("https://host:port");
    SOAPMessage reply = connection.call(message, destination);
    (message is the XML code)
    but the application has the following error:
    com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection post
    GRAVE: SAAJ0009: Fallo en el envío del mensaje
    I think, maybe is a authentication problem, because the XI server needs it. But I don't have idea how can I send the user and pass
    Any IDea???? please
    the libraries are ok imported, I use netweaver to develop-
    thanks in advantage

    hi Leslie,
    there are only a few of these errors,
    you can try this:
    http://www.oxygenxml.com/forum/ftopic1103.html&sid=0abee8c719481a3dd783ff7d5cd84105
    are you sure your URL is accessible from your location?
    you may also check:
    http://www.google.pl/search?hl=pl&q=HttpSOAPConnectionpostSAAJ0009%3A&lr=
    Regards,
    michal

  • Problem using Java Mail API with WLS 7.0

    Hi All,
    I am trying to use the Java Mail API provided by WLS 7.0. I have made the
    settings metioned in the WLS 7.0 docs. However when I try to run the program I
    am getting the following error:
    javax.naming.NoInitialContextException: Need to specify class name in environment
    or system property, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    46)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
    a:283)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    The code that I have written is as follows
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
         public static void main(String args[])
              try
                   //Context ic = getInitialContext();
                   InitialContext ic = new InitialContext();
    /* My jndi name is "testSession" */
                   Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
    IN THIS LINE */
                   Properties props = new Properties();
                   props.put("mail.transport.protocol", "smtp");
                   props.put("mail.smtp.host", "XX.XX.XX.XX");
    /* For security reasons I have written the ip add in this format */
                   props.put("mail.from", "[email protected]"); /* for security reasons i have
    changed the mail address */
                   Session session2 = session.getInstance(props);
                   Message msg = new MimeMessage(session2);
                   msg.setFrom();
                   msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
    false));
                   msg.setSubject("Test Message");
                   msg.setSentDate(new Date());
                   MimeBodyPart mbp = new MimeBodyPart();
                   mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
                   Multipart mp = new MimeMultipart();
                   mp.addBodyPart(mbp);
                   msg.setContent(mp);
                   Transport.send(msg);
              catch(Exception e)
                   e.printStackTrace();
         }//end of main
    public static Context getInitialContext()
         throws NamingException
              Properties p = new Properties();
              p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
              p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
                   p.put(Context.SECURITY_PRINCIPAL, "weblogic");
                   p.put(Context.SECURITY_CREDENTIALS, "weblogic");
              return new InitialContext(p);
    }//end of class
    Can anyone please tell me what is the problem. I thought that we cannot directly
    do
    InitialContext ic = new InitialContext();
    So I had written a method getInitialContext() as shown in the above piece of code,
    but that too did not work.
    Eagerly awaiting a response.
    Jimmy Shah

    You can use InitialContext ic = new InitialContext() only if you are using a startup class, servlet or a JSP i.e
    server side code.
    If you are using a java client you need to use Context ic = getInitialContext();
    Try this code
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
    public static void main(String args[])
    try {
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    h.put(Context.PROVIDER_URL, "t3://localhost:7001");
    Context ic = new InitialContext(h);
    Session session = (Session) ic.lookup("testSession");
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", "XX.XX.XX.XX");
    props.put("mail.from", "[email protected]");
    Session session2 = session.getInstance(props);
    Message msg = new MimeMessage(session2);
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("[email protected]",false));
    msg.setSubject("Test Message");
    msg.setSentDate(new Date());
    MimeBodyPart mbp = new MimeBodyPart();
    mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp);
    msg.setContent(mp);
    Transport.send(msg);
    catch(Exception e)
    e.printStackTrace();
    }//end of main
    }//end of class
    We have shipped a javamail example in the samples\server\src\examples\javamail folder.
    Jimmy Shah wrote:
    Hi All,
    I am trying to use the Java Mail API provided by WLS 7.0. I have made the
    settings metioned in the WLS 7.0 docs. However when I try to run the program I
    am getting the following error:
    javax.naming.NoInitialContextException: Need to specify class name in environment
    or system property, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    46)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
    a:283)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    The code that I have written is as follows
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
    public static void main(String args[])
    try
    //Context ic = getInitialContext();
    InitialContext ic = new InitialContext();
    /* My jndi name is "testSession" */
    Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
    IN THIS LINE */
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", "XX.XX.XX.XX");
    /* For security reasons I have written the ip add in this format */
    props.put("mail.from", "[email protected]"); /* for security reasons i have
    changed the mail address */
    Session session2 = session.getInstance(props);
    Message msg = new MimeMessage(session2);
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
    false));
    msg.setSubject("Test Message");
    msg.setSentDate(new Date());
    MimeBodyPart mbp = new MimeBodyPart();
    mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp);
    msg.setContent(mp);
    Transport.send(msg);
    catch(Exception e)
    e.printStackTrace();
    }//end of main
    public static Context getInitialContext()
    throws NamingException
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
    p.put(Context.SECURITY_PRINCIPAL, "weblogic");
    p.put(Context.SECURITY_CREDENTIALS, "weblogic");
    return new InitialContext(p);
    }//end of class
    Can anyone please tell me what is the problem. I thought that we cannot directly
    do
    InitialContext ic = new InitialContext();
    So I had written a method getInitialContext() as shown in the above piece of code,
    but that too did not work.
    Eagerly awaiting a response.
    Jimmy Shah--
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • How do i connect to sql server using java?

    hi ever body
    i need to connect to sql server using java
    what is the driver i will use?
    thanks

    Microsoft make a jdbc driver and it is readily available through MSDN. Here is a link http://msdn2.microsoft.com/en-us/data/aa937724.aspx. Whatever jdbc driver you are looking for, Google it, and if it exists you'll find it in 10 seconds.

  • Problem with Thunderbird email: When I send email using a mailing list, with my email included in the list, the message shows up in my Sent list and others rece

    Problem with Thunderbird email:
    When I send email using a mailing list, with my email included in the list, the message shows up in my Sent list and others receive it but it does not come to my email Inbox. The same problem occurs when I send the email to the mailing list addresses individually. When I send a simple test message to myself, I do receive it in my Inbox. Can you help me??
    Bob Greenman

    Are you using either cc or bcc? Is googlemail involved? Some email providers suppress cc's and bcc's to oneself since you will have a copy in your Sent folder.

  • Add a posixaccount user in posixgroup in sun directory server using java

    Hi
    Anybody now how to add posixaccount user in posixgroup in sun directory server using java code.
    I am able to add normal directory server user in ldap group in java.
    But i am getting any luck to add posixaccount user in posixgroup.
    I know we can set uid value in memberuid attribute but how to add through java program.
    Anybody can paste code for that.
    Thanks.

    To CRabel,
    My company have restriction on using the open sources product/code, but i will take a look on netscape ldap sdk as a reference~
    To raghu1978 ,
    i find a product call Directory Editor 1 2005Q1, I hope it is useful.
    thz all~

  • Resources for implementing HTTP web server using java

    hi ,
    Thanks for giving your precious time in reading the message.I want to build a HTTP web server using java,which will run on my machine and I can communicate with it through web browser(IE) using HTTP requests and response.
    I know java language, but quite new to network programming.I want to gain enough knowledge on network programming in java.Can you please suggest me good books or any other resources available on the internet for the required subject.Any help will be greatly appreciated.
    my email-id is : [email protected]

    hi there my friend,
    I am writing my own web server too. in w3c there is a sample web server called jigsaw-open source :) and simple-
    I do think it worth trying.
    you can contact me if you want to share some source and info. cause I will.
    [email protected]
    but within 2 weeks I will be back for studying for my web server. you have to wait for a while.

  • Problems concerning "How to integrate MS Exchange Server into SAP EP"

    Hi,
    I want to realize the scenario in "How to integrate Microsoft Exchange Server into SAP Enterprise Portal" from the Microsoft-Website.
    We´re using SAP NetWeaver 04, SAP NetWeaver Portal 6.0.14.0.0 and KMC 6.0.14.2.0 and Microsoft Exchange Server 2000 SP3.
    I have created (as described in the document) the HTTP-System and a WebDAV RM. But the repository doesn´t appeaer in the KM-Content-iView.
    I checked the Component Monitor and got this error-message for "servers" (it was marked with a red square)
    last-error-3   2006-05-16T13:12:11Z: PROPFIND /public: 401 Access Denied
    last-error-4   2006-05-16T13:15:04Z: PROPFIND /public: 401 Access Denied
    last-error-6   2006-05-16T13:26:35Z: PROPFIND /public: 401 Access Denied
    errors   8
    last-error-2   2006-05-16T13:12:10Z: PROPFIND /public: 401 Access Denied
    requests   8
    last-error-7   2006-05-16T13:26:35Z: PROPFIND /public: 401 Access Denied
    bytes-per-second   0
    successes   0
    response-average   194
    last-error-1   2006-05-16T13:11:55Z: PROPFIND /public: 401 Access Denied
    last-error-0   2006-05-16T13:11:54Z: PROPFIND /public: 401 Access Denied
    last-error-5   2006-05-16T13:15:05Z: PROPFIND /public: 401 Access Denied
    failures   0
    Any idea, what´s wrong? And how to solve the problem.
    Thanks for help,
    Sven
    Message was edited by: Sven Keller

    Hi James,
    How can I check the KM ACLs/Security Zones?
    I had a look on "System Administration - System Configuration - Knowledge Management - Content Management - Repository Managers - Security Manager - WebDAV ACL Security Manager".
    There was just "WDAclSecurityManager" and the Permission Rendering Class was "com.sapportals.wcm.control.acl.ResourcePermissionControl".
    Or where do I have to look for the ACL?

Maybe you are looking for

  • Why does my Iphoto keep crashing?

    Here is the report: Date/Time:  2012-02-20 19:51:39.145 -0800 OS Version: 10.4.11 (Build 8S2167) Report Version: 4 Command: iPhoto Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto Parent:  WindowServer [60] Version:    6.0.6 (6.0.6) Build Version

  • Adobe PDF Portfolio - Preview Mode Displaying Incorrect Pages

    I have created a PDF portfolio using the "Grid" template in Adobe Acrobat XI Pro. The Portfolio contains three pdf files. I am getting the following problem when I open the pdf Portfolio in Adobe Reader X and XI and Adobe Acrobat Pro XI. Open the PDF

  • Document delete notification

    Dear all, I need your help with this requirement. We need to send email notification to the document author and administrator whenever a document is manually deleted from UCM. What should be the approach to accomplish this functionality? We explored

  • Entries Multiplying In Calendar & Contacts

    When MobileMe came along I found I started getting events in Calendar repeating themselves and sometimes a Contacts entry would duplicate itself. Now in iCloud I haver the same problem but a hundred times worse. I say a hundred times quite deliberate

  • How to enable MsExchange Management logging..

    Exchange server 2010. I want to access cmdlet history from these logs from event viewer ..