Facing issue when LDAPSync is enabled for OIM-AD integration with SSL enabled

Hi
We are performing LDAPSync for OIM AD real time sync.We have done all configuration as per oracle documentation on LDAPSync for OIM 11gR2 : http://docs.oracle.com/cd/E27559_01/integration.1112/e27123/oid_oim.htm The OIM environment we tested is the latest OIM version OIM 11gR2 PS1 (11.1.2.1.0).
WE have performed LDAPSync enablement on postinstallation of OIM .So we dont have OVD , we have configured libOVD as mentioned in this doc.
We have performed following  steps mentioned in this document  in our OIM environment.
3.1 Enabling Post installation LDAP Synchronization
3.3 Creating Identity Virtualization Library (libOVD) Adapters and Integrating With Oracle Identity Manager
As attribute like password  might be not getting updated in AD from OIM , we have configured SSL enabled integration in LDAP sync as mentioned in above document.
We implemented this step  3.4.1 Enabling SSL Between Identity Virtualization Library (libOVD) and Microsoft Active Directory,
but here it is not properly mentioned that about how to import public key certificate of AD into OIM envirioment for SSL.
We are getting following error message in logs : Looking at logs it looks like the import of AD SSL certificate did not happen properly in OIM environment. But ,we have imported it using keytool and OVD keystore ...please let us know if we are missing any configuration in this process.Above oracle document is not pretty clear on this.
<Dec 7, 2013 12:22:53 AM IST> <Warning> <oracle.ods.virtualization.engine.backend.jndi.LDAP2.BackendJNDI> <OVD-40118> <Could not automatically detect binary attribute list: simple bind failed: 10.88.164.231:636.>
<Dec 7, 2013 12:22:53 AM IST> <Warning> <oracle.ods.virtualization.engine.backend.jndi.LDAP2.JNDIConnectionPool> <OVD-60024> <Connection error: simple bind failed: 10.88.164.231:636.>
<Dec 7, 2013 12:22:53 AM IST> <Error> <oracle.ods.virtualization.engine.backend.jndi.LDAP2.BackendJNDI> <OVD-60143> <[#LDAP2]  Unable to create connection to ldap://[10.88.164.231]:636 as null.
javax.naming.CommunicationException: simple bind failed: 10.88.164.231:636 [Root exception is javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty]
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:195)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2720)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:296)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)
at oracle.ods.virtualization.engine.backend.jndi.JNDIConnectionPool.createCtx(JNDIConnectionPool.java:463)
at oracle.ods.virtualization.engine.backend.jndi.JNDIConnectionPool.create(JNDIConnectionPool.java:494)
at oracle.ods.virtualization.engine.backend.jndi.JNDIConnectionPool.<init>(JNDIConnectionPool.java:156)
at oracle.ods.virtualization.engine.backend.jndi.RemoteServer.getJNDIConnectionPool(RemoteServer.java:163)
at oracle.ods.virtualization.engine.backend.jndi.BackendJNDI.getLDAPContext(BackendJNDI.java:984)
at oracle.ods.virtualization.engine.backend.jndi.BackendJNDI.getConnection(BackendJNDI.java:927)
at oracle.ods.virtualization.engine.backend.jndi.ConnectionHandle.getHolder(ConnectionHandle.java:415)
at oracle.ods.virtualization.engine.backend.jndi.ConnectionHandle.search(ConnectionHandle.java:250)
at oracle.ods.virtualization.engine.backend.jndi.JNDIEntrySet.initialize(JNDIEntrySet.java:219)
at oracle.ods.virtualization.engine.backend.jndi.BackendJNDI.get(BackendJNDI.java:728)
at oracle.ods.virtualization.engine.chain.Chain.nextGet(Chain.java:303)
at oracle.ods.virtualization.engine.chain.BasePlugin.get(BasePlugin.java:89)
at oracle.ods.virtualization.engine.chain.Chain.nextGet(Chain.java:314)
at oracle.ods.virtualization.engine.chain.BasePlugin.get(BasePlugin.java:89)
at oracle.ods.virtualization.engine.chain.plugins.usermanagement.UserManagement.get(UserManagement.java:742)
at oracle.ods.virtualization.engine.chain.Chain.nextGet(Chain.java:314)
at oracle.ods.virtualization.engine.chain.PluginChain.runGet(PluginChain.java:211)
at oracle.ods.virtualization.engine.chain.PluginManager.runGet(PluginManager.java:351)
at oracle.ods.virtualization.engine.chain.PluginManager.runGet(PluginManager.java:316)
...more
Caused By: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1731)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1692)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1675)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1601)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:94)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:414)
at com.sun.jndi.ldap.Connection.writeRequest(Connection.java:387)
at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:332)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:190)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2720)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:296)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)
at oracle.ods.virtualization.engine.backend.jndi.JNDIConnectionPool.createCtx(JNDIConnectionPool.java:463)
at oracle.ods.virtualization.engine.backend.jndi.JNDIConnectionPool.create(JNDIConnectionPool.java:494)
at oracle.ods.virtualization.engine.backend.jndi.JNDIConnectionPool.<init>(JNDIConnectionPool.java:156)
at oracle.ods.virtualization.engine.backend.jndi.RemoteServer.getJNDIConnectionPool(RemoteServer.java:163)
at oracle.ods.virtualization.engine.backend.jndi.BackendJNDI.getLDAPContext(BackendJNDI.java:984)
at oracle.ods.virtualization.engine.backend.jndi.BackendJNDI.getConnection(BackendJNDI.java:927)
...more
Caused By: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:57)
at sun.security.validator.Validator.getInstance(Validator.java:161)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:108)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:204)
at oracle.ods.virtualization.engine.util.OVDTrustManager.checkServerTrusted(OVDTrustManager.java:99)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1198)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:136)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:925)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1170)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:637)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:89)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
Let us know for any helpful pointers on this
Thanks in advance,
RPB25

Use the steps given below to perform import public key certificate of AD into OIM envirioment for SSL
Obtain the AD Certificates from the AD Administrator.
Copy the AD Certificates to the directory /jrockit-jdk1.6.0_20/jre/lib/security
Run the following command to import all the certificates
/jrockit-jdk1.6.0_20/bin/keytool -import -alias <provide_alias> -file <file-name> -keystorecacerts -storepasschangeit
  4. The CA certificates are now present in the trust store.

Similar Messages

  • I am facing issue when opening flash files in Flash CC. (error:- This file was created with a later release of Flash Professional and might contain new features that would be lost when saved in the current format.)

    I am facing issue when opening flash files in Flash CC. (error:- This file was created with a later release of Flash Professional and might contain new features that would be lost when saved in the current format.)

    Wow. Okay...
    I'll let the real veterans in this forum tackle your issues one after the other. But, I can tell you, all will be well.
    My only comment would be re: your computer specs:
    BJReis wrote:
    .  This may be due to somewhat older equipment:
    GHz Intel Core Duo MacBook Pro with a 4GB memory computer with Ddr3 running OSX 10.8.4
    To be completely honest, FCPX is a RAM hog. It just is. But, RAM is relatively cheap, and the pay-off is good.
    4GB is right on the edge, IMHO. 16G is ideal.
    I wish you luck, hang in there, and standby for more help.

  • I am facing issue when opening flash files in Flash CC. (Error : - .fla was created with a later version of Adobe Flash Professional CC and might contain new features not supported in this version of Flash professional.)

    I am facing issue when opening flash files in Flash CC. (Error : - .fla was created with a later version of Adobe Flash Professional CC and might contain new features not supported in this version of Flash professional.)

    fyfesa1970 wrote:
    Ask a simple question and get a simple answer...see below...hilarious:
    All representatives are actively assisting other customers. Your estimated wait time is 0 minute(s) and 1 second(s) or longer. Thank you for your patience.
    We all can learn from this. Whenever you get stuck in a customer-service situation that goes nowhere, as soon as you become aware of the futility, get the name and employee ID of the person, then say, "I don't mean to be rude, I think we're both wasting our time. Perhaps you weren't trained for this issue, or perhaps your system isn't displaying the correct information. It doesn't matter, because I'm not getting proper customer support this way. Please ESCALATE this to your highest-level manager IMMEDIATELY. If that person isn't availabe, ESCALATE me to that person's highest-level manager. If you haven't been given the proper training, you can use this to inform your manager that you need the training. Thanks for trying to help. I appreciate it. I have copied and saved this chat session. NOW PLEASE ESCALATE THIS CASE AS I HAVE REQUESTED ABOVE. I'm waiting now... "
    The point is that you're a customer, and the company needs customers, so the individual who's failing to deliver good service needs to be identified so they can be properly trained, and so that problems in the system can also be identified, but more important is that you get the service you're entitled to.
    If you search the forum for similar questions, you'll see the kind of information that the volunteer users like yourself on the forum need to know about your system and files involved, so they can help you better.
    Good luck.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Anybody facing issues on vodafone in bangalore for iphone 5s. horrible voice breaking occurs.

    anybody facing issues on vodafone in bangalore for iphone 5s. horrible voice breaking occurs. Really frustrting as voice calls break and automaticcaly gets disconnected.

    My current phone is not working. The iOS 8 update has made my phone go from a joy to have to something I want to throw away. I would like to uninstall my update and go back to loving my Iphone again. Can you please help? I've sent numerous messages with no response. I'm trying to stay loyal to Apple however if your only suggestion is to purchase another phone it might not be an Apple product anymore. I'm offering an opportunity to save a client who has multiple Apple products.

  • Issue While executing the Query for Pagination using ROWNUM with like

    Issue While executing the Query for Pagination using ROWNUM with like.
    Database is Oracle11G.
    Oracle Database Table contains 8-9 lakh records
    1) SQL equal (=)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920'
    Execution Time:- 0.00869245 seconds
    Returns 2 resultsets
    2) SQL like (one %)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920%'
    Execution Time:- 0.01094301 seconds
    Returns 2 resultsets
    3) SQL like (two%)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE like '%KMF22600920%'
    Execution Time:- 6.43989658 seconds
    Returns 2 resultsets
    In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
    4) SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
    Execution Time:- Infinite
    ResultSets:- No as execution time is infinite
    a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
    b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
    Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
    Could you please let us know what is the issue with two % used in like and rownum
    5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
    SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
    Execution Time:- 7.41368914 seconds
    Returns 2 resultsets
    Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?

    This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.

  • FI CO Integation: Document type for real-time integration with FI not there

    Dear Gurus,
    This is the error message that I got and I am looking for a solution could anyone help me please.
    I was doing simultaneous costing and doing Product Cost Collector reports.[KKBC_PKO]
    This is IDES 6.00 ehancement package 4,
    How do I define a document type for real-time integration with FI?
    Message no. FAGL_COFI003
    "Diagnosis: For CO documents to be transferred into Financial Accounting in company code 1000, -the system requires a document type".
    How do I go about with this, need steps to resolve this please
    Thank you
    Saleem

    Hi,
    1. Check which variant is assigned to your company code '1000' using this IMG path
    IMG->Financial Acctg (New)->Financial actg global settings (New) ->Real-Time integration of Controlling with Financial Actg ->Assign variants for Real-time Integration to Company codes.
    2. Check if document type is assigned to the variant assigned to your Company code in this path:
    IMG->Financial Acctg (New)->Financial actg global settings (New) ->Real-Time integration of Controlling with Financial Actg -> Define Variants for Real-Time Integration.
    Hope this helps.

  • What is the best way to follow the scenario for Out look integration with share point using SAP Gateway?

    1)what is the best way to follow the scenario for Out look integration with share point using SAP Gateway?
    2)workflow concepts for Purchase order?
    3)Email triggering from out look for an approval process of PO? how these scenario can be best implemented with updated functions in Duet Enterprise.

    Hi,
    I do not have much idea on gateway integration with outlook but found out this document GWPAM Workflow Template which can be helpful for you to start with.
    also you may want to post your question in SAP Microsoft Interoperability forum
    Regards,
    Chandra

  • HT4907 Password Issue when attempting to enable Back to My Mac in iCloud Preferences - HELP?

    Since upgrading to Mountain Lion, I have a problem enabling Back to My Mac. When I try and enable B2MM in the iCloud preferences window, I am asked to enter my Apple ID password. It says the password is incorrect, even though it IS 100% correct. I've even tried resetting my password (so that the password lives up to the latest security requirements for passwords, etc). So, it's definitely correct, and I'm able to login to my Apple account here (on this Apple laptop as well as on my iPad and iPhone)... it's not an issue when I log in anywhere else... I am only told my password is incorrect when attempting to enable Back to My Mac in the iCloud preferences pane.
    Help?
    Many thanks!

    Do these make installation of memeo superfluous? Would I need memeo for daily back up?
    From what I gather, you couldn't pay me to use Memeo, nor actually a Seagate enclosure, nor many USB only drives, (USB is not bootable on PPC Macs).
    I've used maybe a few dozen backup Apps on the Mac, and I'd personally judge only Apple's Time Machine worse than that one.
    If you had it to do all over again, you'd get a case with Firewire, one with an Oxford chipset, not containing a Green Drive, not a Seagate Drive, not less than 7200 RPM drive, & a 32MB Cache, not with a One-Button touch feature, ( not a Bus powered drive like...
    http://eshop.macsales.com/item/Newer%20Technology/MS3S7W20TB32/
    http://eshop.macsales.com/item/Other%20World%20Computing/ME8QW7W20TB/
    I searched hard for answers , not aware of this devoted community. What a wonderful discovery.
    Great to hear & that you found us, tons of devoted, unselfish helpers here too!
    So where are we now on the Drive?
    Does it show up in Disk Utility? Can you repair it there?

  • Facing Issue while Installing SOA server for setting up BPM11g working environment

    Hi All,
    I have been able to install Database and Weblogic Server but I am facing issue in installing SOA server.
    I am trying to install it for running BPM 11g application.
    I saw the same problem has already been answered but available solutions are not resolving my problem.
    Error Message:Provide the JDK/JRE location while launching the installer.Invoke the setup.exe with -jreLoc<JDK/JRE location absolute path>parameter(s).
    I tried both way for initializing the installation. i.e directly through setup.exe and by command prompt but in both the cases I am getting same error.
    It is not asking for Java path in command prompt also.
    a)In my system java 7 is installed.
    b)I have used Oracle Database 11g instead of XE
    Can this be the reason?
    I checked Program Files:
    jre7 and jdk1.7.0_45 are there.
    I also have set JAVA_HOME in environment variable as C:\Program Files\java\jre7
    path :C:\Program Files\java\jdk1.7.0_45\bin
    Please help me in fixing this as I am stuck in this installation from last few days.
    Thanks!

    Hi Binay,
    You might want to consider instead installing it using JDK 1.6.
    Here's where you can check the Fusion Middleware configurations:  http://www.oracle.com/technetwork/middleware/downloads/fmw-11gr1certmatrix.xls
    It's buried in there, but bottom line is that Oracle BPM 11g (PS6) 11.1.1.7 needs JDK 1.6 (for Windows it is either JDK 1.6.0_35 or JRockit 6 Update 37 R28.2.5+) and I'd suggest you use JRockit.
    Dan

  • Issue when using Navigation attributes for filtering in BEX

    Hello,
    We are encountering an issue when applying filter on Navigation attributes in BEx query built on top of a BW HANA Virtual Provider.
    The interface is as below :
    HANA Calculation View -> SAP BW 7.4 Virtual InfoCube -> Multiprovider -> BEx Query.
    We have directly mapped the base Infoobject from HANA View to BW Virtual Provider and using this in BEx query free characteristics. We also have used the navigational attribute of this Infoobject in our Report variable screen as well as an Auth relevant object.
    Eg if ZMATERIAL is the base infoobject and ZMATERIAL__ZXYZ navigational attribute is used in the report variable screen and as Authorization variable.
    This is causing the query to fail.
    The query also fails if I apply any filter values on any Navigational attribute with error message  :
    "Termination message sent ERROR DBMAN (305): Error reading the data of InfoProvider"
    Using the navigational attribute with authorization variable fails with below :
    "Termination message sent ERROR DBMAN (099): Invalid query;Failed to find attribute ZMATERIAL__ZXYZ [...]"
    Appreciate any inputs on this issue and how this can be fixed.
    Thanks,
    Tintu

    Hi Andrey,
    Thank you for your input.
    Based on the OSS note , it says to import BW7.4 SP7. We are already on BW7.4 SP7
    We get error "Termination message sent ERROR DBMAN (099): Invalid query;Failed to find attribute
    ZMATERIAL__ZXYZ"  whenever we try to apply filters on any of the navigational attribute.
    Thanks,
    Tintu

  • Batch number issue when posting goods receipt for Subcontracting PO

    Dear expert,
    I always heard there will be issues while posting goods receipt for subcontracting PO. If the component is managered by batch.
    No batch number will be proposed during PGR in MIGO...
    I dont quite understand where is the issue??
    My understanding:
    We have batch managered components and End Product. All have batch numbers, then we PGI the stock to 'SC stock' via 541 movement type.
    Then Vendor will finish the end product and send us back the end product.
    We consumption the components use 543 O movement type? And GR the end product..
    So while goods receipt, the sytem just need pick the existing batch number for both components and finish products..
    Where are the issues???
    Thanks.

    Hoo Laa wrote:
    I have questions for people always mentioning there are issues with batch determination while post goods receipt for subcontracting orders.
    >
    > I am thinking maybe they didnt active the batch determination for 543 movement type..
    >
    > Thanks.
    Hi Hoo,
    You are right!!
    Setting of batch number determination has its importance in Mvt Type be it 541, 543....
    The issue you might have observed would be with Batch Determination in Goods Issues which folks find it bit tough to achieve n make it work for them.
    Cheers!!
    Shiva

  • FI Changes for HR Payroll Integration with Thrid party Payroll Software

    Hi
    I am looking for information the SAP FI activities/ Changes to be done for enabling SAP HR Payroll integration with third party payroll softwares. Can you give some issues you might have encounter and any recommended thrid party payroll softwares. Highly appreciate any documentation on the same.
    Regards,
    Vic

    Download all the files into Execel, hope after tht u can change it to CSV.... To download HR MASTER DATA use Ad-Hoc qqry. Else use SE11, SE12 or SE16 to download IT wise. PA starts with PA0000 ets OM starts with HRP1000. Hope through this u can download and send to 3rd party system....
    In std we are having an option for 3rd part PY transfer. Check this if help
    SPRO>CROSS APPLICATION COMPONENTS>PREDEFINED ALE BUSINESS PROCESS> HUMAN RESOURCES>HR EXTERNAL SYSTEM

  • Complete working code for Gmail POP3 & SMTP with SSL - Java mail API

    Finally, your code-hunt has come to an end!!!!
    I am presenting you the complete solution (with code) to send and retrieve you mails to & from GMAIL using SMTP and POP3 with SSL & Authenticaion enabled. [Even starters & newbies like me, can easy try, test & understand - But first download & add JAR's of Java Mail API & Java Activation Framework to Netbeans Library Manager]
    Download Java Mail API here
    http://java.sun.com/products/javamail/
    Read Java Mail FAQ's here
    http://java.sun.com/products/javamail/FAQ.html
    Download Java Activation Framework [JAF]
    http://java.sun.com/products/javabeans/jaf/downloads/index.html
    Also, The POP program retrieves the mail sent with SMTP program :) [MOST IMPORTANT & LARGELY IN DEMAND]okey.. first things first... all of your thanks goes to the following and not a s@!te to me :)
    hail Java !!
    hail Java mail API !!
    hail Java forums !!
    hail Java-tips.org !!
    hail Netbeans !!
    Thanks to all coders who helped me by getting the code to work in one piece.
    special thanks to "bshannon" - The dude who runs this forum from 97!!I am just as happy as you will be when you execute the below code!! [my 13 hours of tweaking & code hunting has paid off!!]
    Now here it is...I only present you the complete solution!!
    START OF PROGRAM 1
    SENDING A MAIL FROM GMAIL ACCOUNT USING SMTP [STARTTLS (SSL)] PROTOCOL OF JAVA MAIL APINote on Program 1:
    1. In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
    2. Use the code to make your Gmail client [jsp/servlets whatever]
    //Mail.java - smtp sending starttls (ssl) authentication enabled
    //1.Open a new Java class in netbeans (default package of the project) and name it as "Mail.java"
    //2.Copy paste the entire code below and save it.
    //3.Right click on the file name in the left side panel and click "compile" then click "Run"
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class Main
        String  d_email = "[email protected]",
                d_password = "PASSWORD",
                d_host = "smtp.gmail.com",
                d_port  = "465",
                m_to = "[email protected]",
                m_subject = "Testing",
                m_text = "Hey, this is the testing email.";
        public Main()
            Properties props = new Properties();
            props.put("mail.smtp.user", d_email);
            props.put("mail.smtp.host", d_host);
            props.put("mail.smtp.port", d_port);
            props.put("mail.smtp.starttls.enable","true");
            props.put("mail.smtp.auth", "true");
            //props.put("mail.smtp.debug", "true");
            props.put("mail.smtp.socketFactory.port", d_port);
            props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.put("mail.smtp.socketFactory.fallback", "false");
            SecurityManager security = System.getSecurityManager();
            try
                Authenticator auth = new SMTPAuthenticator();
                Session session = Session.getInstance(props, auth);
                //session.setDebug(true);
                MimeMessage msg = new MimeMessage(session);
                msg.setText(m_text);
                msg.setSubject(m_subject);
                msg.setFrom(new InternetAddress(d_email));
                msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
                Transport.send(msg);
            catch (Exception mex)
                mex.printStackTrace();
        public static void main(String[] args)
            Main blah = new Main();
        private class SMTPAuthenticator extends javax.mail.Authenticator
            public PasswordAuthentication getPasswordAuthentication()
                return new PasswordAuthentication(d_email, d_password);
    END OF PROGRAM 1-----
    START OF PROGRAM 2
    RETRIVE ALL THE MAILS FROM GMAIL INBOX USING Post Office Protocol POP3 [SSL] PROTOCOL OF JAVA MAIL APINote:
    1.Log into your gmail account via webmail [http://mail.google.com/]
    2.Click on "settings" and select "Mail Forwarding & POP3/IMAP"
    3.Select "enable POP for all mail" and "save changes"
    4.In the code below replace USERNAME & PASSWORD with your respective GMAIL account username and its corresponding password!
    PROGRAM 2 - PART 1 - Main.java
    //1.Open a new Java class file in the default package
    //2.Copy paste the below code and rename it to Mail.java
    //3.Compile and execute this code.
    public class Main {
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            try {
                GmailUtilities gmail = new GmailUtilities();
                gmail.setUserPass("[email protected]", "PASSWORD");
                gmail.connect();
                gmail.openFolder("INBOX");
                int totalMessages = gmail.getMessageCount();
                int newMessages = gmail.getNewMessageCount();
                System.out.println("Total messages = " + totalMessages);
                System.out.println("New messages = " + newMessages);
                System.out.println("-------------------------------");
    //Uncomment the below line to print the body of the message. Remember it will eat-up your bandwidth if you have 100's of messages.            //gmail.printAllMessageEnvelopes();
                gmail.printAllMessages();
            } catch(Exception e) {
                e.printStackTrace();
                System.exit(-1);
    END OF PART 1
    PROGRAM 2 - PART 2 - GmailUtilities.java
    //1.Open a new Java class in the project (default package)
    //2.Copy paste the below code
    //3.Compile - Don't execute this[Run]
    import com.sun.mail.pop3.POP3SSLStore;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Date;
    import java.util.Properties;
    import javax.mail.Address;
    import javax.mail.FetchProfile;
    import javax.mail.Flags;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Part;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.URLName;
    import javax.mail.internet.ContentType;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.ParseException;
    public class GmailUtilities {
        private Session session = null;
        private Store store = null;
        private String username, password;
        private Folder folder;
        public GmailUtilities() {
        public void setUserPass(String username, String password) {
            this.username = username;
            this.password = password;
        public void connect() throws Exception {
            String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
            Properties pop3Props = new Properties();
            pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
            pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
            pop3Props.setProperty("mail.pop3.port",  "995");
            pop3Props.setProperty("mail.pop3.socketFactory.port", "995");
            URLName url = new URLName("pop3", "pop.gmail.com", 995, "",
                    username, password);
            session = Session.getInstance(pop3Props, null);
            store = new POP3SSLStore(session, url);
            store.connect();
        public void openFolder(String folderName) throws Exception {
            // Open the Folder
            folder = store.getDefaultFolder();
            folder = folder.getFolder(folderName);
            if (folder == null) {
                throw new Exception("Invalid folder");
            // try to open read/write and if that fails try read-only
            try {
                folder.open(Folder.READ_WRITE);
            } catch (MessagingException ex) {
                folder.open(Folder.READ_ONLY);
        public void closeFolder() throws Exception {
            folder.close(false);
        public int getMessageCount() throws Exception {
            return folder.getMessageCount();
        public int getNewMessageCount() throws Exception {
            return folder.getNewMessageCount();
        public void disconnect() throws Exception {
            store.close();
        public void printMessage(int messageNo) throws Exception {
            System.out.println("Getting message number: " + messageNo);
            Message m = null;
            try {
                m = folder.getMessage(messageNo);
                dumpPart(m);
            } catch (IndexOutOfBoundsException iex) {
                System.out.println("Message number out of range");
        public void printAllMessageEnvelopes() throws Exception {
            // Attributes & Flags for all messages ..
            Message[] msgs = folder.getMessages();
            // Use a suitable FetchProfile
            FetchProfile fp = new FetchProfile();
            fp.add(FetchProfile.Item.ENVELOPE);       
            folder.fetch(msgs, fp);
            for (int i = 0; i < msgs.length; i++) {
                System.out.println("--------------------------");
                System.out.println("MESSAGE #" + (i + 1) + ":");
                dumpEnvelope(msgs);
    public void printAllMessages() throws Exception {
    // Attributes & Flags for all messages ..
    Message[] msgs = folder.getMessages();
    // Use a suitable FetchProfile
    FetchProfile fp = new FetchProfile();
    fp.add(FetchProfile.Item.ENVELOPE);
    folder.fetch(msgs, fp);
    for (int i = 0; i < msgs.length; i++) {
    System.out.println("--------------------------");
    System.out.println("MESSAGE #" + (i + 1) + ":");
    dumpPart(msgs[i]);
    public static void dumpPart(Part p) throws Exception {
    if (p instanceof Message)
    dumpEnvelope((Message)p);
    String ct = p.getContentType();
    try {
    pr("CONTENT-TYPE: " + (new ContentType(ct)).toString());
    } catch (ParseException pex) {
    pr("BAD CONTENT-TYPE: " + ct);
    * Using isMimeType to determine the content type avoids
    * fetching the actual content data until we need it.
    if (p.isMimeType("text/plain")) {
    pr("This is plain text");
    pr("---------------------------");
    System.out.println((String)p.getContent());
    } else {
    // just a separator
    pr("---------------------------");
    public static void dumpEnvelope(Message m) throws Exception {       
    pr(" ");
    Address[] a;
    // FROM
    if ((a = m.getFrom()) != null) {
    for (int j = 0; j < a.length; j++)
    pr("FROM: " + a[j].toString());
    // TO
    if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
    for (int j = 0; j < a.length; j++) {
    pr("TO: " + a[j].toString());
    // SUBJECT
    pr("SUBJECT: " + m.getSubject());
    // DATE
    Date d = m.getSentDate();
    pr("SendDate: " +
    (d != null ? d.toString() : "UNKNOWN"));
    static String indentStr = " ";
    static int level = 0;
    * Print a, possibly indented, string.
    public static void pr(String s) {
    System.out.print(indentStr.substring(0, level * 2));
    System.out.println(s);
    }END OF PART 2
    END OF PROGRAM 2
    P.S: CHECKING !!
    STEP 1.
    First compile and execute the PROGRAM 1 with your USERNAME & PASSWORD. This will send a mail to your own account.
    STEP 2.
    Now compile both PART 1 & PART 2 of PROGRAM 2. Then, execute PART 1 - Main.java. This will retrive the mail sent in step 1. njoy! :)
    In future, I hope this is added to the demo programs of the Java Mail API download package.
    This is for 3 main reasons...
    1. To prevent a lot of silly questions being posted on this forum [like the ones I did :(].
    2. To give the first time Java Mail user with a real time working example without code modification [code has to use command line args like the demo programs - for instant results].
    3. Also, this is what google has to say..
    "The Gmail Team is committed to making sure you always can access your mail. That's why we're offering POP access and auto-forwarding. Both features are free for all Gmail users and we have no plans to charge for them in the future."
    http://mail.google.com/support/bin/answer.py?answer=13295
    I guess bshannon & Java Mail team is hearing this....
    Again, Hurray and thanks for helping me make it!! cheers & no more frowned faces!!
    (: (: (: (: (: GO JCODERS GO!! :) :) :) :) :)
    codeace
    -----                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Thanks for the reply,
    I did checked by enabling session debuging and also checked pop settings it's enabled for all
    mails, I tried deleting some very old messages and now the message count is changed to 310.
    This may be the problem with gmail.
    Bellow is the output i got,
    DEBUG: setDebug: JavaMail version 1.4ea
    DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]
    DEBUG POP3: connecting to host "pop.gmail.com", port 995, isSSL false
    S: +OK Gpop ready for requests from 121.243.255.240 n22pf5432603pof.2
    C: USER [email protected]
    S: +OK send PASS
    C: PASS my_password
    S: +OK Welcome.
    C: STAT
    S: +OK 310 26900234
    Custom output: messageCount : 310
    C: QUIT
    S: +OK Farewell.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • SRM 7.0 for Public Sector integrated with FM (Budget Control System)

    Hello!
    I'm starting an implementation project of ERP 6.0 and SRM 7.0 for Public Sector.
    It would be necesary the integration not only SRM with ERP but with FM (Fund Management), with BCS (Budget Control System) specifically.
    Is it possible? has anyone experience on it?
    Thks so much in advance and best regards!
    Marcela.-

    Hi,
    Certainly... If you have FM implemented in your project, you will have to make integration with SRM.
    I did it some 3 years ago and it was quite problematic (a lot of notes were created by SAP on this matter, also as initiative from our project), but since then, I assume, it should not pose specific problems.
    Regards,
    Eli

  • Facing issue when Extending two VO's

    Dear all,
    We are trying to extend VO
    The VO which we are extending is under page reference not directly associated with the page.
    Means ReceiptBasedLinesVO is further extending ExpenseReportLinesVO (It contains respective method which we need to overwrite)
    For achieving the same we ahve tried below Cases:
    Case 1:
    Extending ReceiptBasedLinesVO :
    public class ExtReceiptBasedLinesVOImpl extends ReceiptBasedLinesVOImpl
    public class ExtReceiptBasedLinesVORowImpl extends ReceiptBasedLinesVORowImpl
    Extending ExpenseReportLinesVO:
    public class ExtExpenseReportLinesVOImpl extends ExpenseReportLinesVOImpl
    public class ExtExpenseReportLinesVORowImpl extends ExpenseReportLinesVORowImpl
    When we are executing above scenario getting below exception:
    Error java.lang.ClassCastException: xxx.oracle.apps.ap.oie.server.ExtReceiptBasedLinesVORowImpl incompatible with xxx.oracle.apps.ap.oie.server.ExtExpenseReportLinesVORowImpl
    Case 2:
    Tried below scenario also , but it’s also giving the incompatible exception:
    public class ExtReceiptBasedLinesVOImpl extends ExtExpenseReportLinesVOImpl (As per standard functionality)
    Exception Details.
    oracle.apps.fnd.framework.OAException: java.lang.ClassCastException: xxx.oracle.apps.ap.oie.server.ExtReceiptBasedLinesVOImpl incompatible with oracle.apps.ap.oie.server.ReceiptBasedLinesVOImpl at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:912) at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:886)
    Any Pointers or inputs to resolve the issue will be great help.
    Regards
    Kumar

    Any one who has faced the similar situation , please suggest.

Maybe you are looking for

  • Why is my iTunes asking for me to confirm password for an ID that's not mine?

    Hi guys, First timer here! A pretty weird but potentiallly serious issue here... Firstly, this is not for me but to help a colleague. He left his MacBook Pro in a taxi a few weeks ago and it's since been lost, we tried using 'Find my Mac' through iCl

  • Flash Builder 4 CSS Design Mode

    Hello,      I would like to know why CSS Design mode was removed from Flash Builder 4?      I am a Design/Developer so it was much easier for me to use CSS in Design mode.      What are my options? Is there any other tools for visual editing CSS for

  • [Solved] lib32-libcurl-gnutls

    lib32-libcurl-gnutls is a library which is required to run Witcher 2: https://wiki.archlinux.org/index.php/Witcher2 but unfortunately doesn't exist in the AUR. I found an old and somewhat hackish PKGBUILD: https://bbs.archlinux.org/viewtopic.php - 49

  • Updating a row of a table using rowid

    Hi folks, I am trying to update some rows in a table using rowid of the corresponding rows.Sometimes this updates wrong rows. This is because ORACLE by itself makes some statistics on the particular table using "Analyze table..." statement and it cha

  • How to make a table in java without using GUI??

    how can i make a table in java without usinf GUI, just simple codes?? NAME ID NUMBER ADDRESS STATUS