3 Replies Latest reply on Jan 19, 2009 10:33 AM by 843834

    javax.mail.NoSuchProviderException: smtp again

    843834
      I can telnet to localhost 25
      I have added the entire mail141 api to the classpath
      I try to send a SMTPmessage via SMTPTransport (no space left for code)


      But it does not work ?!
      This is the dbug output:
      ------------------------------------

      DEBUG: not loading system providers in <java.home>/lib
      DEBUG: successfully loaded optional custom providers from URL: jar:file:<MY_PATH>imap.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded optional custom providers from URL: jar:file:<MY_PATH>pop3.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded optional custom providers from URL: jar:file:<MY_PATH>smtp.jar!/META-INF/javamail.providers
      DEBUG: successfully loaded default providers

      DEBUG: Tables of loaded providers
      DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
      DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc]}
      DEBUG: successfully loaded optional address map from URL: jar:file:/E:/RSA_WORKSPACES/head/SZRWatchdog/smtp.jar!/META-INF/javamail.address.map

      DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
      java.lang.reflect.InvocationTargetException
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled Code))
           at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled Code))
           at javax.mail.Session.getService(Session.java:607)
           at javax.mail.Session.getTransport(Session.java:541)
           at javax.mail.Session.getTransport(Session.java:484)
           at javax.mail.Session.getTransport(Session.java:464)
           at javax.mail.Session.getTransport(Session.java:519)
           at javax.mail.Transport.send0(Transport.java:155)
           at javax.mail.Transport.send(Transport.java:81)
      ........
      Caused by: java.lang.NoSuchMethodError: javax.mail.Session: method getDebugOut()Ljava/io/PrintStream; not found
           at com.sun.mail.smtp.SMTPTransport.<init>(SMTPTransport.java:72)
           ... 14 more
      javax.mail.NoSuchProviderException: smtp
           at javax.mail.Session.getService(Session.java:611)
           at javax.mail.Session.getTransport(Session.java:541)
           at javax.mail.Session.getTransport(Session.java:484)
           at javax.mail.Session.getTransport(Session.java:464)
           at javax.mail.Session.getTransport(Session.java:519)
           at javax.mail.Transport.send0(Transport.java:155)
           at javax.mail.Transport.send(Transport.java:81)
      ....

      Edited by: kppu on Jan 16, 2009 4:04 AM

      Edited by: kppu on Jan 16, 2009 4:08 AM
        • 1. Re: javax.mail.NoSuchProviderException: smtp again
          843834
          I replaced the single mail components in classpath with the entire mail.jar

          Now I have this Debug Info :

          DEBUG: not loading system providers in <java.home>/lib
          DEBUG: not loading optional custom providers file: /META-INF/javamail.providers
          DEBUG: successfully loaded default providers

          DEBUG: Tables of loaded providers
          DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
          DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
          DEBUG: not loading optional address map file: /META-INF/javamail.address.map

          DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
          java.lang.reflect.InvocationTargetException
               at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
               at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
               at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:44)
               at java.lang.reflect.Constructor.newInstance(Constructor.java:315)
               at javax.mail.Session.getService(Session.java:607)
               at javax.mail.Session.getTransport(Session.java:541)
               at javax.mail.Session.getTransport(Session.java:484)
               at javax.mail.Session.getTransport(Session.java:464)
               at javax.mail.Session.getTransport(Session.java:519)
               at javax.mail.Transport.send0(Transport.java:155)
               at javax.mail.Transport.send(Transport.java:81)
          ...
          Caused by: java.lang.NoSuchMethodError: javax.mail.Session: method getDebugOut()Ljava/io/PrintStream; not found
               at com.sun.mail.smtp.SMTPTransport.<init>(SMTPTransport.java:72)
               ... 14 more
          javax.mail.NoSuchProviderException: smtp
               at javax.mail.Session.getService(Session.java:611)
               at javax.mail.Session.getTransport(Session.java:541)
               at javax.mail.Session.getTransport(Session.java:484)
               at javax.mail.Session.getTransport(Session.java:464)
               at javax.mail.Session.getTransport(Session.java:519)
               at javax.mail.Transport.send0(Transport.java:155)
               at javax.mail.Transport.send(Transport.java:81)
          ...
          • 2. Re: javax.mail.NoSuchProviderException: smtp again
            Bill Shannon-Oracle
            If you have mail.jar in your CLASSPATH, get rid of imap.jar, pop3.jar and smtp.jar - you don't need them
            because everything in them in included in mail.jar. Ditto mailapi.jar. This is described in the NOTES.txt
            file included with JavaMail.

            If that doesn't solve your problem, and I don't think it will, look for other copies of mail.jar, or other jar
            files containing the javax.mail classes. It looks to me like you've got a mix of old and new javax.mail
            classes in your CLASSPATH.
            • 3. Re: javax.mail.NoSuchProviderException: smtp again
              843834
              You were right (again)
              I had another Project linked to this project which includes j2ee.jar which comes with its own javax.mail package.
              I regrouped the classpath and now it works

              Thank you for your help

              Edited by: kppu on Jan 19, 2009 2:33 AM

              Edited by: kppu on Jan 19, 2009 2:33 AM